I am the main author and designer of MELT, a domain specific language to extend GCC (the Gnu Compiler Collection). The implementation is available free software (GPLv3 licensed). If you want a detailed description, from the point of view of a Domain Specific Language, read my DSL2011 paper on MELT.
I have chosen a Lisp-like syntax for MELT, so as in Lisp or in Scheme, every operation is written with "Lots of Insipid Stupid Parenthesis" so the application of function f
to arguments a
and b
is written (f a b)
(like it is in Scheme or in Lisp). Of course, (f)
-a function application without argument- is not the same as f
-a simple thing denoted by a variable-.
MELT shares with many other Lisp-s and with Scheme the usual "control" operators like let if defun define cond lambda letrec list definstance
etc...
MELT does not use the common names for primitive operations (no car
or +
in MELT, which has pair_head
list_first
+i
+iv
with different meanings). And MELT deals with both first-class values (like in Scheme) and "stuff" (for raw GCC data like Gimple, details are in the DSL2011 paper)
The reasons I have chosen a Lisp-like syntax includes:
- first, I am lame, and wanted to have a quick implementation. Parsing Lisp is trivial;
- I was (and am) able to use e.g. Emacs
lisp-mode
for MELT without trouble. - A small MELT implementation was originally prototyped in Common Lisp
- Current MELT translator is bootstrapped so is written in MELT
- The implementation uses classical Lisp tricks: S-expressions are expanded by a macro mechanism (into a sort of internal abstract syntax tree), then normalized, and finally translated to C code.
- GCC has several Lisp like formalisms inside (notably for the back-end, for "machine description" files).
- the GNU projects have Emacs Lisp and Guile as Lisp-like dialects (I was not able to use them for technical reasons detailed in my DSL2011 paper).
My question is: should I offer an alternative, infix-like syntax (a bit Pythonic or Lua-esque)?
One one hand, I am afraid that some people (particularly young ones, who never met any Lisp-like programming languages; I had a course on Lisp in the 1980-s) are completely allergic to Lisp and won't even try MELT because of its look.
On the other hand, the only thing I could do is some simple parser producing the same AST as MELT has today, and the syntax will be ad-hoc (but infixed) and probably not pretty.
Also, working on an alternative syntax which I won't use will distract me (or take time) from other efforts (writing documentation & tutorial, making good examples of MELT, debugging and improving the implementation).
Some young persons (in particular Jeremie Salvucci and Pierre Vittet) have been able to learn and code MELT without prior exposure to MELT, to Lisp dialects (or Scheme) or even to compilation.
Would an alternative syntax attract people allergic to Lisp? A nice guy told me that syntax does not matter really for DSL-s. They can be adopted if they bring some value, even with a not very sexy syntax.