simponic.xyz/godel/index.html

94 lines
2.6 KiB
HTML
Raw Permalink Normal View History

2023-11-17 12:04:55 -05:00
<!DOCTYPE html>
2023-11-16 16:56:56 -05:00
<html>
2023-11-17 12:04:55 -05:00
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
2023-11-17 12:04:55 -05:00
<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>
2024-04-29 14:24:27 -04:00
<p><i>Developed to Explore Ideas In Theory of Computability</i></p>
2023-11-17 12:04:55 -05:00
<hr>
<div class="source-container">
<div class="textarea-container">
<h3>L Source</h3>
<textarea id=
"instructions">// 0. primitive instructions only
2023-11-17 16:19:03 -05:00
// 1. anything following the comment token "//" up to a
2023-11-17 12:04:55 -05:00
// newline are ignored.
2023-11-17 16:19:03 -05:00
// 2. by default, a computation that takes more than 500_000
2023-11-17 12:04:55 -05:00
// "procedures", it will be halted.
2023-11-17 16:19:03 -05:00
// 3. the implicit exit label "E1" exists; thus to exit
2023-11-17 14:09:44 -05:00
// prematurely, "GOTO E1".
2023-11-17 16:19:03 -05:00
// 4. input your initial snapshot in the "variables" map
2023-11-17 12:04:55 -05:00
// on the Program in the compiled JS output
2023-11-17 16:19:03 -05:00
// 5. for a more detailed view on the grammar, it's at
2023-11-17 12:04:55 -05:00
// /godel/grammar.peg
2023-11-17 14:09:44 -05:00
// THIS PROGRAM COMPUTES X1 + X2
2023-11-17 12:04:55 -05:00
// Y &lt;- X1
[ A1 ] IF X1 != 0 GOTO A2
GOTO B1
[ A2 ] X1 &lt;- X1 - 1
Y &lt;- Y + 1
GOTO A1
// Z1 &lt;- X2
[ B1 ] IF X2 != 0 GOTO B2
GOTO C1
[ B2 ] X2 &lt;- X2 - 1
Z1 &lt;- Z1 + 1
GOTO B1
// Y &lt;- Y + Z1
[ C1 ] IF Z1 != 0 GOTO C2
2023-11-17 14:09:44 -05:00
GOTO E1
2023-11-17 12:04:55 -05:00
[ C2 ] Z1 &lt;- Z1 - 1
Y &lt;- Y + 1
GOTO C1</textarea>
<div>
2023-11-17 14:12:57 -05:00
<button id="compile">Compile</button> <button id=
"copy">Copy</button>
2023-11-16 21:06:35 -05:00
</div>
2023-11-17 12:04:55 -05:00
<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>
2023-11-16 21:06:35 -05:00
</div>
2023-11-16 16:56:56 -05:00
</div>
</div>
2023-11-17 14:09:44 -05:00
<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>
2023-11-17 12:04:55 -05:00
</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>
2023-11-16 16:56:56 -05:00
</html>