-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisual.html
173 lines (165 loc) · 4.44 KB
/
visual.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="/paperjs-v0.11.4/dist/paper-full.js"></script>
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<!-- default paperscript paser doesn't support ECMA2015-->
<!-- so you need to import newer version of acorn.js -->
<script src='https://cdnjs.cloudflare.com/ajax/libs/acorn/4.0.11/acorn.js'></script>
<script type="text/paperscript" canvas="myCanvas" src="/visual.js"></script>
<script src="/eval_generator.js"></script>
<script src="/filereader.js"></script>
<script src="/visual_b_examples.js"></script>
<!-- for homepage -->
<!-- <script type="text/paperscript" canvas="myCanvas" src="/static/assets/js/visual.js"></script>
<script src="/static/assets/js/eval_generator.js"></script>
<script src="/static/assets/js/filereader.js"></script>
<script src="/static/assets/js/visual_b_examples.js"></script> -->
</head>
<style>
html,
body {
margin: 0;
height:100%;f
overflow: hidden;}
/* Scale canvas with resize attribute to full size */
.ast{
height: 80%;
}
canvas[resize] {
width: 75%;
height: 100%;
margin-left: -8%; }
#control {
position:fixed;
top: 30px;
left: 30px;
width: 120px;
text-align: left; }
#control div {
margin: 10px; }
/* table.result {
margin: auto; }*/
button{
width: 85px;
}
#control .zoom{
width: 40px;
}
button.example {
width: 20px;
text-align: center;
}
#memory{
text-align: center;
position:fixed;
top: 280px;
left: 10px; }
#memory-scroll{
width: 250px;
height:150px;
overflow:auto;
margin-top:20px; }
#memory table {
width:100%;
border-collapse: collapse;
table-layout: fixed;}
#memory table, #memory td {
border: 1px Beige solid; }
#memory td{
width:20%;
}
#memory tr.addr{
font-size: 0.5em; }
#env{
text-align: center;
position:fixed;
top: 450px;
left: 10px; }
#env-scroll{
width: 250px;
height:150px;
overflow:auto; }
#env table {
width:100%;
border-collapse: collapse;
table-layout: fixed;}
#env table, #env td {
border: 1px Beige solid; }
#env td{
width:50%; }
#print{
position:fixed;
top: 10%;
right: 8%;
height: 40%; }
#print-content{
height:100%;
overflow:auto; }
#result {
position:fixed;
width: 250px;
bottom:10%;
right:3%; }
</style>
<body onload="checkFileAPI();" style="text-align: center;">
<div id="control">
<div><input type="file" onchange='readText(this)'/></div>
<!-- for homepage -->
<!-- <div><input type="file" onchange='readAndUploadText(this)'/></div> -->
<div><button class='zoom' type="button" onclick='zoom(1)'> + </button>
<button class='zoom' type="button" onclick='zoom(-1)'> - </button></div>
<div><button type="button" onclick='executeOne()'>Run</button></div>
<div><button type="button" onclick='executeAll()'>Run all</button></div>
<div><button type="button" onclick='initialize(window.j)'>Reset</button></div>
<div><button id="toggle-code" type="button" onclick='toggleCode()'>Show code</button></div>
<div>
Examples</br>
<button class="example" type="button" onclick='runEx1()'>1</button>
<button class="example" type="button" onclick='runEx2()'>2</button>
<button class="example" type="button" onclick='runEx3()'>3</button>
<button class="example" type="button" onclick='runEx4()'>4</button>
</div>
</div>
<div id="memory">
<div id="memory-scroll">
<h3>Memory</h3>
<table>
</table>
</div>
</div>
<div id="env">
<div id="env-scroll">
<h3>Environment</h3>
<table>
</table>
</div>
</div>
<div id="print">
<h3 >Printed<br>(Side effects)</h3>
<div id="print-content">
<table>
</table>
</div>
</div>
<div id="result">
<h3> Interpretation of<br>the current node</h3>
<h4 id="result-content"></h4>
</div>
</div>
<div class="ast">
<h3> Abstract Syntax Tree for B language </h3>
<canvas id="myCanvas" resize="true"></canvas>
<div style="position:fixed; top: 10vh; left: 35%; right: 30%" >
<pre style="text-align:left;">
<code>
</code>
</pre>
</div>
</body>
</html>