[antlr-interest] more specific (lang independent?) actions (WAS: header sections)

Monty Zukowski monty at codetransform.com
Thu Nov 18 10:34:09 PST 2004


On Nov 18, 2004, at 9:59 AM, Terence Parr wrote:
> grammar P(...options..., package=org.antlr.test, super=DBGParser);
>
> import {
> import java.io.*;
> }
>
> init {
> 	code, not a ctor method def.  Just code to init
> 	antlr will generate this into the ctor or whatever
> }
>
> fields {
> String currentMethodName;
> int level;
> }
>
> methods {
> public void computeFoo() {
> 	...
> }
> }
>
>

So are these handled by a generic rule like ID '{' (.)* '}'  where the 
stuff inside is just passed as an attribute to the template?  So 
antlr.g doesn't have to change if some other language needs its own 
special block?

Monty



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list