X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=blobdiff_plain;f=README.md;h=0a861b9d609e10a1788bade63c844325063c5a08;hb=82718616a82ff93f0f307b36d0ba510c5c58a127;hp=2f78b7e1cacd1578810072bba4c4afa2c67ef29a;hpb=133e62278bc80778a34f1ec1fdded5ec0bfb6b5e;p=scheme.forth.jl.git diff --git a/README.md b/README.md index 2f78b7e..0a861b9 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,55 @@ At this point you can start entering Scheme commands. For example, > (factorial 5) ; 120 +Metacircular Evaluator +====================== + +Of course, one of the things you can do in Scheme (or of course any programming +language, this is the fundamental thing) is implement an interpreter for +another programming language. The examples directory in this repository +contains a verbatim copy of the source for the "metacircular" scheme interpreter +from SICP. To load it, use the following command: + + > (load "../examples/metacirc.scm") + ; ok + +Be prepared to wait a couple of minutes. When the interpreter finally loads, enter +the following command to run it: + + > (driver-loop) + +You'll then be greeted by the following prompt: + + ;; M-Eval input: + +At this point you can start entering Scheme commands... but be prepared to wait +a while for the result. After all, when evaluating commands in the MCE you are +running a program in a Scheme interpreter running inside another Scheme +interpreter which is itself running on a Forth system that is implemented atop +the Julia numerical computing environment. **That's three levels of +abstraction more than a native Julia program experiences**, so some delay is to +be expected! + +For instance, the following example from SICP defines and demonstrates a +recursive list append procedure: + + (define (append x y) + (if (null? x) + y + (cons (car x) + (append (cdr x) y)))) + + ;;; M-Eval value: + ok + + ;;; M-Eval input: + (append '(a b c) '(d e f)) + + ;;; M-Eval value: + (a b c d e f) + +You may have to wait a minute or so for the final result to be printed. + License =======