[antlr-interest] Can parser rules be ignored in syntax checking?

xdjicn xdji at ustc.edu
Mon Oct 28 18:36:41 PST 2002


In building a compiler, I want to preprocess the source file and 
build the symbol table first,but the grammar file is very large,so I 
hope to only analyse partial grammars,i.e. ignore some rules,which 
will reduce the time cost in preprocessing,is there some way to 
achieve it?Thanks.

/*Given the rules below,I want to just analyse the typeDef and  
constDef (including the definitions in function) and ignore the 
controlDef*/

moduleDef :
   "module" Identifier moudleBody;
moduleBody :
    "{" (typeDef)* 
        (constDef)* 
        (functionDef)*
        (controlDef)?
     "}";
typeDef:
      ....  
;
constDef:
      ....
;
functionDef :
     "function" Identifier functionBody;
functionBody:
     "{"
        (constDef)*              //local definition part
        (varDef)*
        ....
     "}"
controlDef:
     ....
;



 

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



More information about the antlr-interest mailing list