[antlr-interest] Composite Grammar

Fred phreed at gmail.com
Tue Mar 4 15:15:07 PST 2008


I'm having some difficulty downloading the antlr.tgz snapshot from
http://fisheye2.cenqua.com/browse/antlr
...or should I be using
http://www.antlr.org/download/build/antlr-2008-02-27.17.tar.gz anyway?

On Tue, Mar 4, 2008 at 4:28 PM, Terence Parr <parrt at cs.usfca.edu> wrote:

> yes, see
> examples-v3.1b1.tar.gz<http://www.antlr.org/download/examples-v3.1b1.tar.gz>
>
> i have a java grammar broken into multiple pieces :)
>
> /** Exact same grammar as examples-v3/java/Java.g but broken into
>  *  multiple pieces to illustrate composing grammars via import statement.
>  *  Results in multiple classes with Java referring to others via
>  *  delegation pattern.  Run ANTLR only once on this root grammar:
>  *
>  *      java org.antlr.Tool Java.g
>  */
> grammar Java;
> options {k=2; backtrack=true; memoize=true;}
>
> import JavaDecl, JavaAnnotations, JavaExpr, JavaStat, JavaLexerRules;
>
> compilationUnit
>     :   annotations?
>         packageDeclaration?
>         importDeclaration*
>         typeDeclaration*
>     ;
>
> Ter
>
> On Mar 4, 2008, at 2:19 PM, Fred wrote:
>
> I know this question is about a new feature but...
> Is there an example of Composite Grammar using the new features of 3.1?
> Even if it were in the class notes that would be fine.
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080304/af4b83dd/attachment.html 


More information about the antlr-interest mailing list