StringTemplate and Xtext

367 Views Asked by At

In my current work, I have written code generator using String Template without thinking about Parser ( I am instantiating Template files using direct Java Object). and code generator generator generates nice Java code.

Now, I have started to write Parser. B'coz of some nice editor features of xText, I am thinking to write parser in Xtext.

My question is "Is it possible to use code generator ( written using StringTemplate ) and Parse (written in Xtext) in same project?

1

There are 1 best solutions below

4
On BEST ANSWER

Yes that's possible. Xtext offers a typed AST for the parsed files and you could easily pass them to your code generator (directly, iff they fulfil the same contract / interfaces, or indirectly by transforming them to the expected structure). Xtext does not impose any constraints on how you want to use the parsed information.