Tenaja, By default, the generated ANTLR grammar is just a recognizer: it will throw an exception in the presence of a string not in the grammar and it will terminate normally in the presence of a string in the grammar. To get more output from ANTLR (such as an AST), you probably want to set "output=..." in the options section of your grammar. For an informal discussion of "output=AST", try http://www.antlr.org/wiki/display/ANTLR3/Tree+construction . For more detailed information, there is a relatively inexpensive book ("The Definitive ANTLR Reference") that you can buy in electronic form.
For more examples, you might try taking a glance at some of the grammars on the ANTLR site (http://www.antlr.org/grammar/list). There's also a somewhat non-standard approach that I've been forced to use (due to some strange constraints in my project) which is illustrated by the ANTLR grammar used in a branch of the OpenJDK project in which each rule explicitly returns the values that it needs (which are then set by grammar actions). Cheers, Zach > I'm familiar with bnf (etc) files, and have written a simple r/d compiler > myself. I'm looking at antlr for expanding, and for maintenance reason. As > such, I'd like to put together one of my simple bnf languages and view the > output. I've seen a few antlr tutorials, but haven't found one that really > describes the compiled code output (not the antlr output, but what a compiled > exe or java file output produces). > > So... can someone point me to a tutorial that shows what to do AFTER you > compile the anltr-generated file? > > Thanks! > Tenaja > > > > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address > > List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
