Reputation: 64237
If I want to write my engine which will generate all the code solving the task described in simple declarative style, what languages should I look at?
Upvotes: 2
Views: 206
Reputation: 95430
That's an extremely broad topic, so it deserves an extremely broad answer.
An engine designed to implement arbitrary processing and generation of code is the DMS Software Reengineering Toolkit. DMS parses a wide variety of langauges, will accept definitons of more languages (including specification or modelling languages), provides pattern matching and transformation using declarative patterns written at source level syntax, etc.
DMS isn't a single language; rather, it is a set of Domain-Specific Languages (DSLs) each of which provides support for one of the issues that a code metaprogramming tool must address: langauge grammars, attribute computations, pattern matching/transformation, flow analysis, task scripting.
DMS is extremely powerful; it has been used to build many code analysis, generation, and transformation tools (you can see a wide variety of examples at the web site offered as COTS tools). It is not necessarily easy, because analyzing/transforming code for real langauges such as Java, C# and C++ is complicated, because those languages are complicated, and because the fundamental problem of transforming code from one level of abstraction to another and producing optimized results is fundamentally complicated. I'll claim DMS is as easy as practical for the problem targeted.
(Full disclosure: I'm the principal behind DMS).
Upvotes: 0
Reputation: 5351
Prolog. Definitely Prolog. I know it's not the vanilla option, so here is the rationale:
I actually did this sort of projects: Generators from natural-looking Prolog to languages like SQL and Erlang. Getting to know Prolog takes some time, but in my experience it's worth your while.
Upvotes: 1