|
Hi, I've had the need to generate code from custom idl. Often, it was not worth developing a dedicated parser given the simplicity of the language. Instead, the syntax flexibility offered by Lua made it an attractive language to build some domain specific languages that constructs a tree made of Lua tables. Looking at the Lua workshops, it looks like a shared approach although there is room for diverging implementation choices. So I'm sharing the last few days effort on this use case. It's located at: Http://www.bitbucket.com/spoludo/tools/src Under the dsl subdirectory. If there is interest it will certainly move in its own project. Documentations and examples are limited but can hopefully give quite an edge on the intent and usage. Any contributions are welcome along with features requests. The bandwidth to serve them is limited but having them will help prioritizing. tests/suites/3-write/jpa.lua is closer to an example than to a test. Although it doesn't build an ast but directly generates code, it shows how the parsing rules work, and how the writer can be used to generate code. Regards |