[m-users.] Lex & Yacc for Mercury
zoltan.somogyi at runbox.com
Sat Dec 31 11:50:07 AEDT 2016
On Fri, 30 Dec 2016 11:05:27 -0500, Barthwal <barthwal at protonmail.com> wrote:
> I want to write a compile and I was wondering, if there are any Lex & Yacc parsers for Mercury or not.
If by "parsers for Mercury" you mean .l and .y files for the syntax of the
Mercury language, the answer is no. The lexical and syntactic rules of Mercury
were inherited from Prolog, and (among other things) this means that Mercury's
grammar is not LALR, i.e. it is not in the class of grammars that yacc and yacc-like
parsers can handle.
If by "parsers for Mercury" you mean scanner and parser generators that
convert specifications of scanners and parsers into Mercury code, the answer
is yes. I wrote them when I was teaching a compiler class, but they were never
distributed, because I never got around to documenting them.
More information about the users