[antlr-interest] Can anyone help me convert this antlr 2.0 grammar file to antlr 3.0 syntax?

Fabio Santschi kitsune2097 at gmail.com
Wed Oct 29 05:40:30 PDT 2008


I mistakenly posted this on the gouple groups mirror page.

I converted the 'easy' parts (fragment,  @header and @member
declerations etc.), but since I'm new to Antlr I have  a really hard
time converting the Tree statements etc.

The grammar file can be found here:

http://jena.cvs.sourceforge.net/viewvc/*checkout*/jena/jena2/src/com/...<http://jena.cvs.sourceforge.net/viewvc/*checkout*/jena/jena2/src/com/hp/hpl/jena/n3/n3.g>

Below you can find some examples where I run into problems:

[For instance, I have problems with:]

n3Directive0!:
                d:AT_PREFIX ns:nsprefix u:uriref
                {directive(#d, #ns, #u);}
                ;

[or]

propertyList![AST subj]
        : NAME_OP! anonnode[subj] propertyList[subj]
        | propValue[subj] (SEMI propertyList[subj])?
        |               // void : allows for [ :a :b ] and empty list "; .".

        ;

propValue [AST subj]
        :  v1:verb objectList[subj, #v1]
                // Reverse the subject and object
        |  v2:verbReverse subjectList[subj, #v2]
        ;

subjectList![AST oldSub, AST prop]
        : obj:item { emitQuad(#obj, prop, oldSub) ; }
                (COMMA subjectList[oldSub, prop])? ;
objectList! [AST subj, AST prop]
        : obj:item { emitQuad(subj,prop,#obj) ; }
                (COMMA objectList[subj, prop])?
    | // Allows for empty list ", ."
    ;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081029/6c5a1a55/attachment.html 


More information about the antlr-interest mailing list