[antlr-interest] Build path for ANTLRWorks, grammar issues, lexer members

Ruth Karl ruth.karl at gmx.de
Tue May 29 14:42:49 PDT 2007


Hello again,

I am still confronting several problems with ANTLRWorks - and with my 
grammar, too...
One step after the other:

- when generating code via the debug icon (this time with Java as target 
language), I get a bunch of exceptions - even though the generated code 
is ok (eclipse at least does not bother - after setting the project  
build path). The exceptions I get to see in ANTLRWorks console all seem 
to be orignated by missing antlr-libraries:

    [22:47:45]
    D:\workspace_eclipse_3.2\JSP_Parsing\antlr\JSPParser.java:64: cannot
    find symbol
    [22:47:45] symbol  : constructor DebugParser(antlr.TokenStream)
    [22:47:45] location: class org.antlr.runtime.debug.DebugParser
    [22:47:45]             super(input);
    [22:47:45]       

but I can not see where to set the corresponding paths there....


- Next problem is in my grammar. I have the following rules:

    jsp    :    oroot (content)* croot EOF
        |    content* EOF
        ;
    oroot     :     OPENTAG 'jsp:root' (rootattr)* CLOSETAG
        ;
    OPENTAG     :     '<' { tagMode = true; }
        ;

etc, but giving the interpreter an input starting with

    <jsp:root xmlns:jsp="xxx">

it will generate immediately a NoViableAltException... I would expect 
that at least '<' and 'jsp:root' be recognized - am I that wrong???

- if I use the same semantic predicate for lexer and for parser rules in 
my grammar: do I really have to state it twice (@member und 
@lexer::member)? And if so, will they ever be coordinated? Like, when I 
toggle the value of a boolean in a lexer rule - will it be toggled for 
the parser, too? Or how should I do?

Thank you lots again for your help,

Ruth


More information about the antlr-interest mailing list