Le 03/05/2015 10:42, Julien Delplanque a écrit :
> Hi everyone,
>
> I saw on this repository
https://github.com/antlr/grammars-v4 that there
> are a lot of grammar defined. I wonder if someone already managed to
> generate a parser in pharo (using any framework you want) from a ".g4"
> file?
Not me, even if I have spent time pouring over ANTLR-based grammars when
implementing compiler front-ends.
ANTLR-based grammars are LL* (right recursive), so they don't fit very
well with LALR/GLR (SmaCC), they tend to look a bit different from the
programming language official doc or standard (i.e left-recursive), they
are in some cases difficult to reuse because resolution may be done in
ad-hoc fashion (adding arbitrary code to resolve ambiguities), and
whether the grammar is really complete for a given language is hard to
determine (working grammars for real-life complete uses are expensive to
build, so they tend to be kept as company Intellectual Property).
This is my experience.
> I also saw there is the grammar of ".g4" files
> (
https://github.com/antlr/grammars-v4/tree/master/antlr4) in the
> repository so I guess it would be possible to create a parser that
> generate parsers from ".g4" files.
This is correct.
Thierry
>
> Regards,
>
> Julien
>
>
>