blob: f0d12e7807432b328112410dcfa1761b6854e161 (
plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Liz's L-Program Compiler</title>
<link rel="stylesheet" type="text/css" href=
"codemirror/codemirror.css">
<link rel="stylesheet" type="text/css" href="css/styles.css">
</head>
<body>
<div class="container">
<h1>Liz's L-Program Compiler</h1>
<p><i>Developed for Kulyukin's CS5000</i></p>
<hr>
<div class="source-container">
<div class="textarea-container">
<h3>L Source</h3>
<textarea id=
"instructions">// 0. primitive instructions only
// 1. anything following the comment token "//" up to a
// newline are ignored.
// 2. by default, a computation that takes more than 500_000
// "procedures", it will be halted.
// 3. the implicit exit label "E1" exists; thus to exit
// prematurely, "GOTO E1".
// 4. input your initial snapshot in the "variables" map
// on the Program in the compiled JS output
// 5. for a more detailed view on the grammar, it's at
// /godel/grammar.peg
// THIS PROGRAM COMPUTES X1 + X2
// Y <- X1
[ A1 ] IF X1 != 0 GOTO A2
GOTO B1
[ A2 ] X1 <- X1 - 1
Y <- Y + 1
GOTO A1
// Z1 <- X2
[ B1 ] IF X2 != 0 GOTO B2
GOTO C1
[ B2 ] X2 <- X2 - 1
Z1 <- Z1 + 1
GOTO B1
// Y <- Y + Z1
[ C1 ] IF Z1 != 0 GOTO C2
GOTO E1
[ C2 ] Z1 <- Z1 - 1
Y <- Y + 1
GOTO C1</textarea>
<div>
<button id="compile">Compile</button> <button id=
"copy">Copy</button>
</div>
<div>
<span style="margin-left: 0.5rem" id=
"compile_status"></span>
</div>
</div>
<div class="textarea-container">
<h3>Compiled JS</h3>
<textarea id="compiled"></textarea>
<div>
<button id="eval">Eval</button>
</div>
<div>
<span style="margin-left: 0.5rem" id=
"eval_status"></span>
</div>
</div>
</div>
<div class="textarea-container">
<h3>Godel</h3>
<p>Sequence:</p>
<pre id="godel_sequence"></pre>
<div>
<p>Number: <button id="godel_number_comp" style=
"display: none">Compute (this might take a
while)</button></p>
</div>
<pre id="godel_number"></pre>
</div>
</div>
<script src="codemirror/codemirror.js"></script>
<script src="js-beautify/js-beautify.js"></script>
<script src="js/observable.js"></script>
<script src="js/parser.js"></script>
<script src="js/compiler.js"></script>
<script src="js/main.js"></script>
</body>
</html>
|