Distel notes

Luke Gorrie luke@REDACTED
Thu Nov 21 20:16:41 CET 2002


"Julian Fondren" <cleverjulian@REDACTED> writes:

> >(Y'know, it would be interesting to do a super-tiny interpreter in
> >Erlang, so that Distel could send a list like (io:format "Hello from
> >~p" (self)) and Erlang could interpret it to run the code.. that might
> >reduce the amount of supporting Erlang code that needs to be written
> >(and installed on the machine running the node.))
> 
> Well, there's erl_eval, and I'm pretty sure that there's a list
> evaluator as you request, but I don't see it anywhere.  Anyway:

On the topic of interepters, I don't think I posted my last
scheme-like-language interpreter on the list - it's definitely not
"canonical" yet but it's much better than my previous attempts. It's
580 lines of code and its most advanced features are quasiquote and
defmacro (the next one will have to have call/cc!), plus 56 lines
written in itself to implement let, if, case, etc

http://www.bluetail.com/~luke/misc/lersp.tar.gz

Usage:

  cd lersp
  make
  ./lersp.sh

src/ is the interpreter and priv/ is the library written in itself.

NB: don't use tabs in source files, because it contains the following
amusing line:

  -define(WHITESPACE(X), X == $\s; X == $\r; X == $\n).

:-)

NB2: I wonder where a person can learn to write a complete "canonical"
scheme interpreter in e.g. scheme? Books like _Structure and
Interpretation of Computer Programs_ tell you all about evaluators,
but not quasiquote, macros, the reader, ...

Cheers,
Luke




More information about the erlang-questions mailing list