https://github.com/akkartik/mu/blob/master/apps/mulisp.mu
1
2
3 fn main args-on-stack: (addr array addr array byte) -> exit-status/ebx: int {
4 var args/eax: (addr array addr array byte) <- copy args-on-stack
5 var tmp/ecx: int <- length args
6 $main-body: {
7
8 compare tmp, 1
9 {
10 break-if-<=
11
12 var tmp2/ecx: (addr addr array byte) <- index args, 1
13 var tmp3/eax: boolean <- string-equal? *tmp2, "test"
14 compare tmp3, 0
15 {
16 break-if-=
17 run-tests
18 exit-status <- copy 0
19 }
20 break $main-body
21 }
22
23 enable-keyboard-immediate-mode
24 repl
25 enable-keyboard-type-mode
26 exit-status <- copy 0
27 }
28 }
29
30 type cell {
31 tag: int
32
33
34
35 value: int
36
37
38 name: (handle array byte)
39
40
41 left: (handle cell)
42 right: (handle cell)
43
44 stream: (handle stream byte)
45 }
46
47 fn repl {
48 var c: (handle cell)
49 var c-ah/ecx: (addr handle cell) <- address c
50 lisp-read c-ah
51 var c-a/eax: (addr cell) <- lookup c
52 compare c-a, 0
53 break-if-=
54 lisp-eval c-a c-ah
55 lisp-print c-a
56 loop
57 }
58
59 fn lisp-read out: (addr handle cell) {
60 }
61
62 fn lisp-eval in: (addr cell), out: (addr handle cell) {
63 }
64
65 fn lisp-print in: (addr cell) {
66 }