[antlr-interest] An ANTLR-based XMI translator

Cameron Ross cross at kojeware.com
Thu Jan 7 13:06:57 PST 2010


Hi,

I need to construct a program that will translate UML models specified 
in XMI into language 'X'.  I already have an ANTLR-based parser for 
language X that generates a CommonTree as an intermediate form.  I also 
have a TreeWalker  that uses StringTemplate to emit valid X given an AST 
in this intermediate form.  I currently use these two components to 
implement a pretty-printer for language X.  I was thinking that I could 
implement an ANTLR parser that would take XMI models as input and 
generate some (different) intermediate form AST.   I would then 
implement a TreeWalker to convert this AST into the intermediate form 
AST for language X.  This would allow me to use my existing emitter to 
output the model in language X.

1) Does this sound like a reasonable strategy?
2) Is anyone aware of an existing ANLTR3 grammar for XMI?
3) Is there a better way?

Thanks,
Cameron.


More information about the antlr-interest mailing list