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