[antlr-interest] Syntax I do not understand

Jorge Scandaliaris j_scandaliaris at yahoo.es
Fri Jun 20 03:56:57 PDT 2003


Hi,
	That is used for controlling the AST construction. See
http://www.antlr.org/doc/trees.html#_bb1 for more details.

Jorge 

> -----Original Message-----
> From: ahwkong2000 [mailto:anthony.kong at ufjia.com]
> Sent: Friday, June 20, 2003 10:35 AM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] Syntax I do not understand
> 
> Hi, all,
> 
> I think the list has grown rather quiet last few days. :-)
> 
> I am new to antlr and would like to know more about how to build a
> lexer and parser. I am studying the TinyBasic.g
> 
> In the file I encountered:
> 
> functionDefinition
>         options {defaultErrorHandler = true;} // let ANTLR handle
> errors
>         {
>                 int fnType=0;
>                 Vector pVector=null;
>         }
>         :       p:"function"^ fnType=n:newFunction
> {#p.setType(FUNCTION_DEF);}
>                         {
>                                 theContext.pushScope(new
> FunctionScope(theContext.getCurrentScope()));
>                         }
>                         pVector=params:parameters       eol!
>                 // now parse the body of the class
>                 cb:procedureBlock
>                 quit:"end" "function"! eol!
>                 {
>                         #quit.setType(EXIT_MODULE);
>                         DTCodeType fnc;
>                         fnc=new
> DTFunction(fnType,#params,#cb,theContext.getCurren
> tScope(),pVector,#n.getText());
>                         #functionDefinition =
> #(#[FUNCTION_DEF,"FUNCTION_DEF"],#functionDefinition);
>                         theContext.popScope();
>                         theContext.insertFunction(#n.getText(),fnc);
>                 }
> 
> 
> I do not quite understand the line:
> 
>                         #functionDefinition =
> #(#[FUNCTION_DEF,"FUNCTION_DEF"],#functionDefinition);
> 
> What does it suppose to do here?
> 
> 
> Any help is appreciated!
> 
> 
> Anthony
> 
> 
> 
> 
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/



 

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




More information about the antlr-interest mailing list