-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
140 lines (122 loc) · 3.78 KB
/
index.html
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<!doctype HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Wathon: A Python-to-Wasm compiler">
<title>Wathon!</title>
<style>
body {
width: 100vw;
max-width: 100%;
height: 100vh;
margin: 0;
display: flex;
flex-direction: column;
}
header>* {
text-align: center;
margin: 0;
padding: 0.5rem;
}
main {
width: 100%;
height: 100%;
}
#code-form {
display: grid;
grid-template-columns: 2fr 3fr;
margin: 0;
width: 100%;
height: 100%;
}
#code-form>fieldset {
border: 0
}
@media(max-width:900px) {
#code-form {
display: inline-block;
}
#user-code {
min-height: 20vh;
}
}
#code-form>* {
padding: 0.5rem;
}
#input-fields {
display: flex;
flex-direction: column;
}
#user-code {
height: 100%;
resize: none;
font-family: monospace;
}
#output-fields>pre {
white-space: break-spaces;
}
#output-fields>label {
font-weight: bold
}
#memory th,
#memory td {
text-align: center;
padding: 0.25rem;
}
</style>
</head>
<body>
<header>
<h1>Wathon: A Python-to-Wasm Compiler</h1>
</header>
<main>
<form id="code-form">
<fieldset id="input-fields">
<button id="run">Run!</button>
<label for="user-code" style="text-align:center">Enter Python code here:</label>
<textarea id="user-code"></textarea>
</fieldset>
<fieldset id="output-fields">
<label class="output label" for="output" hidden>Prints and final return value:</label>
<pre><output id="output"></output></pre>
<hr class="line" hidden>
<table id="memory" hidden>
<tr>
<th>Address</th>
<th>4</th>
<th>8</th>
<th>12</th>
<th>16</th>
<th>20</th>
<th>24</th>
<th>28</th>
<th>32</th>
<th>36</th>
<th>40</th>
</tr>
<tr id="mem-values">
<th>Memory</th>
<td><output></output></td>
<td><output></output></td>
<td><output></output></td>
<td><output></output></td>
<td><output></output></td>
<td><output></output></td>
<td><output></output></td>
<td><output></output></td>
<td><output></output></td>
<td><output></output></td>
</tr>
</table>
<hr class="line" hidden>
<label class="output label" for="output" hidden>Generated code:</label>
<pre><code><output id="generated-code"></output></code></pre>
</fieldset>
</form>
</main>
<script src="https://cdn.jsdelivr.net/gh/AssemblyScript/[email protected]/index.js"></script>
<script>const wabt = WabtModule;</script>
<script src="webstart.js"></script>
</body>
</html>