Ok,I'm trying to integrate a v3 ANTLR parser into the mainline. We  
need this eventually as the new front end to ANTLR itself but also I  
wanted to integrate Leon's cool Strip program that knows how to print  
grammars back out with lots of different things stripped:

usage: java org.antlr.morph.Strip [args] file.g [file2.g [file3.g ...]]
  -strip-rewrite        strip off rewrites and rule/token reference  
labels
  -strip-label          strip off rule/token reference labels
  -grammar-option       keep grammar options
  -grammar-action       keep grammar actions, e.g. header, members.
  -globalscope          keep global scopes
  -rule-argument        keep rule arguments
  -rule-returnvalue     keep rule return values
  -rule-throws          keep rule throws specification
  -rule-option          keep rule options
  -rule-scope           keep rule scope
  -rule-action          keep rule actions, e.g. @init, @after.
  -rule-exception       keep rule exception group
  -alt-action           keep alternative actions
  -alt-ruleargument     keep alternative rule reference arguments
  -alt-tokenargument    keep alternative token reference arguments
  -label                keep rule/token reference labels
you need to provide a grammar file.

I have make sure that the grammar in org/antlr/grammar/v3  is the  
latest version we have. thanks to everyone including Leon gave me  
fixes. The problem I have is that I will need only ASTs out of the  
grammar but Leon's strip program needs parse trees, which requires - 
debug option. It uses the debug events to build parsers.  I have the  
tree grammar that walks an ANTLR AST. I don't want to have two  
versions of the grammar; well, actually a single version but with two  
different builds: one with and one without debugging.

So, perhaps I adapt Leon's tool to use the rewrite stream and ASTs  
with the tree grammar rather than the parse tree. I think I can get a  
lot of his logic into the tree grammar from a parse tree. that is the  
direction I'm going.

With luck, all future stuff can see directly off of a generic AST and  
the grammar can stay pristine.

Ter

_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org/mailman/listinfo/antlr-dev

Reply via email to