OT Re: Meta-Erlang

Vlad Balin vlad@REDACTED
Fri Sep 30 14:04:46 CEST 2005


> With respect to programs as data, I've not really found anything that
> can best Lisp and co.
Yes, it's due to the fact that Lisp and co don't have a syntax. Syntax tree
structure defined directly with "lots of irritating silly parenthesis".
That's why writing language extensions (macros) are so simple.

However, there's quite interesting work done in this area for languages with
syntax. Camlp4 is pre-processor for OCaml language (ML family) allowing you
to easily extend language grammar. And this approach looks very, very nice.
http://pauillac.inria.fr/caml/camlp4/

Example: pascal-like repeat-until loop.

       open Pcaml;;
       EXTEND
         expr: LEVEL "expr1"
           [[ "repeat"; e1 = expr; "until"; e2 = expr ->
                 <:expr< do { $e1$; while not $e2$ do { $e1$; } } >> ]];
       END;;

It would be interesting to see something similar in dynamic language with
syntax like Erlang.

>Although Forth (using meta interpreters) is
> very interesting, but its philosophy is ever so slightly too stark for
> my taste.  The DB aspect of Smalltalk is great for experimental
> coding, but I tend to get lost along the way, making it impossible to
> figure out what my architecture looks like (or, for that matter, is
> meant to look like).
Yes.

> I am a great believer in literate programming approaches.  But that
> approach, at least through the tools currently available, depends on
> the fact that a program is a listing of some sort.
Agree. :)




More information about the erlang-questions mailing list