-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path42minjoy.joy
43 lines (40 loc) · 993 Bytes
/
42minjoy.joy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
(*
module : 42minjoy.joy
version : 1.4
date : 02/10/25
*)
(* the JOY interpreter written in JOY *)
joy ==
[ [
(* PUSH DATA: *)
[ zzz ] (* type void *)
[ false ] (* Booleans *)
[ 'A ] (* characters *)
[ 0 ] (* numbers *)
[ [] ] (* lists *)
(* OPERATIONS: *)
[ pop pop pop ]
[ dup pop dup ]
[ swap pop swap ]
[ cons pop cons ]
[ uncons pop uncons ]
[ opcase pop opcase ]
[ * pop * ]
[ + pop + ]
[ - pop - ]
[ / pop / ]
[ and pop and ]
[ or pop or ]
[ not pop not ]
[ body pop body ]
[ put pop put ]
[ get pop get ]
(* COMBINATORS: *)
[ i pop [joy] cons i ]
[ dip pop [joy] cons dip ]
[ step pop [joy] cons step ]
(* DEFINED *)
[ joy body joy ] ]
opcase
i ]
step ;