I was开发者_开发技巧 having difficulty figuring out what does ^ and ! stand for in ANTLR grammar terminology.Have a look at the ANTLR Cheat Sheet:
Grammar: grammar test; WS:( \' \' \'\\t\' \'\\r\' \'\\n\' ) {$channel=HIDDEN;} ; STRING :\'\"\' ( ESC_SEQ | ~(\'\\\\\'|\'\"\') )* \'\"\'
In Antlrworks I get this error: [18:21:03] Checking Grammar Grammar.g... [18:21:26] Grammar.java:12: code too large
I have downloaded ANTLR 1.3 and ANTLRWorks and can generate rules and syntax diagrams OK. When I try to generate code (e.g. by GenerateCode in ANTLRWorks or with java org.antlr.Tool Temp.g I get
The recommended pattern for ANTLR usage is to have the Parser construct an Abstract Syntax Tree, and then build Tree walkers (AKA tree grammars) to process them.