问题
My current project is focusing on code generation from High-level specification. More specifically, developers write high-level specifications and compiler parses them and generates Java code. For parser, I have used ANTLR grammar and for code generation I have used StringTemplateFiles.
For providing nice editor support (with syntax high lighting & coloring), I have used xText.
Now, the real problem comes - how can I integrate xText editor support with ANTLR parser and code generator? I want to provide nice eclipse plugin to developers.
Should I stick with xText and try to solve integration problem?/ Should I use only ANTLR and StringTemplateFiles and try to create Eclipse plugin out of it (I do not know - how can I do this)?
Other alternative suggestions are also welcomed.
回答1:
Xtext generates Antlr parser and support template based generation via xtend in addition to the eclipse plugin - why not use it exclusively?
回答2:
You do not have to use xtend to write the code generator. the only thing you have to cope with is the interface IGenerator
it should be possible to call StringTemplate from there (Implementing the call in Java or Xtend)
来源:https://stackoverflow.com/questions/23290093/antlr-and-xtext-integration-for-developing-plugin