All: *ARGV* and *host-language*. Misc syncing/fixes.
[jackhill/mal.git] / README.md
CommitLineData
60154d24
JM
1# mal - Make a Lisp
2
bcddc3e4
JM
3## Description
4
5Mal is an interpreter for a subset of the Clojure programming
b3402a82 6language. Mal is implemented from scratch in 12 different languages:
bcddc3e4 7
edc3b064 8* Bash shell
bcddc3e4 9* C
edc3b064
JM
10* C#
11* Clojure
bcddc3e4 12* Java
edc3b064 13* Javascript
bcddc3e4
JM
14* GNU Make
15* mal itself
edc3b064
JM
16* PHP
17* Postscript
18* Python
8adb0827 19* Ruby
bcddc3e4
JM
20
21
22Mal is also a learning tool. Each implentation of mal is separated
23into 11 incremental, self-contained (and testable) steps that
24demonstrate core concepts of Lisp. The last step is capable of
25self-hosting (running the mal implemenation of mal).
26
27The mal (make a lisp) steps are:
28
29* step0_repl
30* step1_read_print
31* step2_eval
32* step3_env
33* step4_if_fn_do
34* step5_tco
35* step6_file
36* step7_quote
37* step8_macros
38* step9_interop
39* stepA_more
40
41
42Mal was presented publicly for the first time in a lightning talk at
43Clojure West 2014 (unfortunately there is no video). See
44mal/clojurewest2014.mal for the presentation that was given at the
45conference (yes the presentation is a mal program).
60154d24
JM
46
47## Building/running implementations
48
bcddc3e4 49### Bash 4
60154d24
JM
50
51```
52cd bash
53bash stepX_YYY.sh
54```
55
bcddc3e4 56### C
60154d24 57
54c75382
JM
58The C implementation of mal requires the following libraries: glib,
59libffi6 and either the libedit or GNU readline library.
60
60154d24
JM
61```
62cd c
63make
64./stepX_YYY
65```
66
edc3b064
JM
67### C#
68
69The C# implementation of mal has been tested on Linux using the Mono
70C# compiler (mcs) and the Mono runtime (version 2.10.8.1). Both are
71required to build and run the C# implementation.
72
73```
74cd cs
75make
76mono ./stepX_YYY
77```
78
79
bcddc3e4 80### Clojure
60154d24
JM
81
82```
83cd clojure
84lein with-profile +stepX trampoline run
85```
86
bcddc3e4 87### Java 1.7
60154d24
JM
88
89```
90cd java
91mvn compile
92mvn -quiet exec:java -Dexec.mainClass=mal.stepX_YYY
93 # OR
94mvn -quiet exec:java -Dexec.mainClass=mal.stepX_YYY -Dexec.args="CMDLINE_ARGS"
95```
96
bcddc3e4 97### Javascript/Node
60154d24
JM
98
99```
100cd js
54c75382 101npm update
60154d24
JM
102node stepX_YYY.js
103```
104
bcddc3e4 105### Mal
60154d24
JM
106
107Running the mal implementation of mal involves running stepA of one of
108the other implementations and passing the mal step to run as a command
5d446bd8 109line argument.
60154d24
JM
110
111```
112cd IMPL
113IMPL_STEPA_CMD ../mal/stepX_YYY.mal
114
115```
116
bcddc3e4 117### GNU Make 3.81
60154d24
JM
118
119```
120cd make
121make -f stepX_YYY.mk
122```
123
bcddc3e4 124### PHP 5.3
60154d24
JM
125
126```
127cd php
128php stepX_YYY.php
129```
130
bcddc3e4 131### Postscript Level 2/3
60154d24
JM
132
133```
134cd ps
135gs -q -dNODISPLAY stepX_YYY.ps
136```
137
a05f7822 138### Python (2 or 3)
60154d24
JM
139
140```
141cd python
142python stepX_YYY.py
143```
8adb0827
JM
144
145### Ruby (1.8)
146
147```
148cd ruby
149ruby stepX_YYY.rb
150```