[erlang-questions] Sexp front end for Erlang?

Robert Virding robert.virding@REDACTED
Tue Oct 17 22:12:58 CEST 2006


Peter Mechlenborg wrote:
> Hi,
> 
> I'm new to the list, but I hope that I'm not too far off topic.
> 
> At the company I work for, we have recently started implementing a 
> domain specific language with an Erlang back end and have a prototype 
> compiler written in Common Lisp.  Instead of generating Erlang source 
> code directly, the compiler has two phases with an sexp layer in 
> between, that is, the first phase in the compiler generates sexp's 
> corresponding to Erlang code, and the second phase generates Erlang 
> source code from the sexp's.
> 
> Currently the sexp layer is very simple, but I was wondering if someone 
> else has played with the idea of an sexp-based front end for Erlang, or 
> even made one?  If so I would be very interested to hear more about it.
> 
> I tried to google for something like the above, but I did not find anything.

As far as I know no one has done an sexp-based front end.

There would be no problems in actually doing it but you would end up 
doing quite a lot of work. The problem is that most of the system uses 
tuples almost exclusively to represent structures and lists to 
represent, well, lists. Lisp uses sexps, ie lists, for much much more.

Even if you defined a sexp-based syntax, which you seem to have done, 
then you would to convert this to tuples to process in the compiler and 
evaluator. The return values from most built-ins and libraries use 
tuples for structures so all return values would seem strange from a 
list pow.

Unfortunately, while it could be done, it just wouldn't fit with the 
rest of the system. Which is a great shame as lisp syntax IS cool and 
you can do a lot of fun things with it which is difficult with erlang.

Pity,

Robert

(defun ask (?proc ?ques)
     (send ?proc ?ques)
     (receive
	((?proc ?repl) () ?repl)))



More information about the erlang-questions mailing list