[antlr-interest] Only one import level with ANTLR-3.1.1?
Terence Parr
parrt at cs.usfca.edu
Mon Oct 27 10:42:14 PDT 2008
On Oct 27, 2008, at 10:25 AM, Laurent Caillette wrote:
> Hi all,
>
> The import feature of ANTLR is great but I've found what seems to be a
> bug with ANTLR-3.1.1.
>
> Consider we have:
> - A lexer grammar L.
> - A parser grammar P1, importing L.
> - A parser grammar P2, importing P1 (and L, but it doesn't matter
> here).
>
> As a pure parser grammar, ANTLR doesn't let P1 import L. It produces
> errors like this:
Parsers cannot import Lexers. you should be able to import a lexer
into a combined grammar, however. There is currently a limitation I
think that you cannot import a combined into a combined.
Ter
>
> error(103): P1.g:6:0: parser rule letter not allowed in lexer
> The message denotes some kind of confusion because P1 is the *parser*,
> so parser rules should be allowed here.
>
> If I declare P1 as a combined grammar, ANTLR generates the code for P1
> but fails on P2 as import of combined grammars is not supported. So I
> see no way to go beyond one import level.
>
> I can send some example code if needed but this should be easy to
> reproduce.
>
> Does anybody know a workaround for this?
>
> Regards,
>
> c.
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
More information about the antlr-interest
mailing list