Xtext code generation using other JVM languages, e.g. Scala [message #1091924] |
Thu, 22 August 2013 05:31 |
Shelby Moore III Messages: 42 Registered: August 2013 |
Member |
|
|
I want to use Scala for the code generation, because I am writing a fairly sophisticated compiler for a general purpose language (that builds on and outputs to Scala). For example, I want to use Scala's pattern matching on the AST to make the code more succinct. And eventually I will rewrite the compiler to use the language I am building for code generation.
How do I employ another JVM language for code generation?
The default settings apparently create a workflow which puts the source for code generation in a {ProjectName}Generator.xtend file in the org.xtext.{ProjectFileExt}.generator folder.
I have viewed the thread about using .java as the source language, but I didn't even understand what (if anything) was resolved in that thread.
I have seen the a mention of a mixed Scala and Xtext project, but that did not add any insight for me at least.
I have seen the thread about Xtext's Java integration and I don't understand it. I think this may have to do with the ability to embed Java in the grammar? Don't understand if or how this might apply to what I want to accomplish above.
The only other possible relevant pages I have found are:
voelterblog dot blogspot dot com/2009/09/using-scala-for-xtext-scope-definitions.html
www dot assembla dot com/wiki/show/scala-ide/Eclipse_Plugin_Development_using_the_Scala_IDE
I must say that I am lost in a vast sea of APIs that I don't think I could wrap my head around with a big picture understanding in any reasonable time frame.
Could someone offer me some pointers to shorten the learning curve? Or point me to the relevant documentation to read?
[Updated on: Thu, 22 August 2013 13:54] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
Re: Xtext code generation using other JVM languages, e.g. Scala [message #1744850 is a reply to message #1092230] |
Fri, 30 September 2016 18:06 |
|
I know this is an old thread, but I am also interested in this issue. So let me try.
Quote:After that, I want to learn how to do post processing on the EMF model to output Scala extractors for all the generated Java classes, so I can use Scala's pattern matching in the code generation method I want to delegate to above.
OP, have you ever got to that?
|
|
|
Powered by
FUDForum. Page generated in 0.05083 seconds