[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C syntax in Lisp

Erann Gat (gat@robotics.jpl.nasa.gov) wrote:
: Discussions about the virtues of Lisp syntax arise perenially.  Although
: I personally like prefix notation, I have to deal with customers who do
: not, and who will not change their minds any time soon.  Therefore, I
: have written a partial C syntax parser in Common Lisp.  Currently it
: handles expressions only, not statements (e.g.: x=foo.baz[3+z] ==>
: (setf x (aref (struct-ref foo 'baz) (+ 3 z)))  ) ...
: 1.  Has anyone else done something similar that they are willing to
: release?  I prefer not to reinvent wheels.

Years ago (early '70s) there was a tranlator called Mlisp from
Stanford that translated an Algol-like syntax into Lisp 1.6.  You
might look at that.  The source used to be available and there was a
tech report describing it.  The downside of using it was that all
debugging was still in the destination (i.e. lisp w/ parens)
language.  Unless you allow debugging in the source language I
don't think that your customers will be very happy.
Show them LOOP.  That almost looks like a c/pascal :-).

Also, from time to time there have been read macros that translate infix
arithmetic expressions to lisp-type prefix ones.  I don't have any
pointers for those.


Institute for the Learning Sciences, 1890 Maple, Evanston Il 60201