Login  Register

Re: ANTLR4 to SmaCC

Posted by Thierry Goubier on May 31, 2017; 6:22pm
URL: https://forum.world.st/ANTLR4-to-SmaCC-tp4948738p4948762.html

Hi Henrique,

Le 31/05/2017 à 17:03, Henrique Rocha a écrit :
> Hello,
>
> I was trying to convert a ANTLR4 grammar specification to SmaCC. After many
> unsuccessful tries that made me question my sanity I wondered: maybe someone
> has a solution. Grammar conversion is something that can be automated.

Sort of.

LL(*) brings itself to entirely different hacks to play with the tokens
and lexical analysis that LR() grammars, and most of the hard work on
parsers is in that area.

I haven't looked if the reversed recursion in ANTLR is hard to convert.

The use of the + * ? [ ] symbols is nice because it hides effectively on
which side the recursion happens (left recursion in LR, right recursion
in ANTLR)

> My question is if anyone has done something to convert an ANTLR4 grammar to
> a SmaCC grammar?

Write a ANTLRv4 grammar syntax grammar in SmaCC would do the trick.

Apart from semantic actions of course.

Regards,

Thierry

> Thanks and farewell,
>
> - Henrique
>
>
>
> --
> View this message in context: http://forum.world.st/ANTLR4-to-SmaCC-tp4948738.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>