I need to translate text files from language A to language B.  I already
have the following antlr3 gear for these languages:
  - an antlr grammar for language A that produces AST_A
  - a tree walker (tw_A) that transforms AST_A to AST_B'
  - an antlr grammar for language B that produces AST_B
  - a tree walker (tw_B) that uses string templates to transform AST_B into
text for language B

I'd like to establish the following pipeline to translate text files from
language A to language B:
 - text_A -> lexer_A -> parser_A -> tw_A -> tw_B -> text_B

However, tw_B does does not properly walk trees generated by tw_A.  This is
probably a result of the tree walkers being compiled against difference
token vocabularies.  Is there a way to somehow integrate vocabularies so
that you can reuse a pre-compiled back-end like this?

If not, I guess I'll have to integrate tw_B with the source generation
process for the language A components.  However, this also has challenges.
 Note that AST_B' (from language A) is a subset of AST_B and not all of the
tokens referenced in tw_B are present in tw_A.  That is, , so tw_B requires
more than just tokenVocab=tw_A.

I could cut-and-paste tw_B to create a tw_A2, but I plan to use AST_B as an
intermediate form for translating several languages to language B, so I'm
looking to reuse...  I'd like to keep tw_B independent from tw_A.

Thanks,
Cameron.

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to