In my application I have to type in some code for a specific domain and I would like to create a DSL for that. The DSL just should have some really basic commands.
DSL code example:
srccode{
code: "if("
func: insertInputData(1)
code: "){\n "
func: insertOutputData(0)
code: "\n}\n"
cond: checkForOutputConnection(1):
code: "else{\n "
func: insertOutputData(1)
code: "\n}\n"
}
This code should get translated into source code of a general purpose language (f.ex. Python) like this:
def getSrcCode():
s = ""
s += "if("
s += insertInputData(1)
s += "){\n "
s += insertOutputData(0)
s += "\n}\n"
if(outputConnected(1)):
s += "else{\n "
s += insertOutputData(1)
s += "\n}\n"
return s
So its actually just about a simple translation.
- Xtext seems to get quite complex no later than when trying to integrate it in other (non-java) applications and well it seems to stich to Java.
- JetBrains MPS is surely is something completely awesome but I don't want a projectional editor, just pure text
(this might be wrong, I didn't use any of them so far)
What workbench or tool would you recommend me to use to achieve the possibility to translate the code into other languages easily like as shown (I prefer something, that is fairly limited somehow but easy to learn and use while fitting my low needs).