[antlr-interest] packrat vs. LL(*)

Michael micha-1 at fantasymail.de
Mon Jun 8 04:57:39 PDT 2009


Am Monday 08 June 2009 13:36:53 schrieb Steven Obua:
>
> It is really just a parsing question, the whole lexing issue is
> besides the point. Note that you can have ANTLR grammars without a
> lexer, just as in a packrat grammar.

if I use:
parser grammar P;

options {
        output = AST;
        backtrack=true;
        memoize=true;
        k=1;
}

start: content EOF;
content: 'a'+ ;

I get an error, since the lexer is missing:
ANTLR Parser Generator  Version 3.1.1
error(107): P.g:11:10: literal has no associated lexer rule: 'a'
error(107): P.g:11:10: literal has no associated lexer rule: 'a'



if I use instead:
grammar P;   // missing parser keyword

// rest the same

it works but generates a lexer.

cheers,
 Michael



More information about the antlr-interest mailing list