-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
47 lines (40 loc) · 1.59 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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Implementing a simple language</title>
<style>
body { font-family: Arial, Helvetica, sans-serif; margin: 2% 5% 2% 5%;}
ul { list-style-type: none; }
ul, li { margin-top: 0.1cm; margin-bottom: 0.1cm; }
</style>
<script src="scripts/ProgrammingLanguage.js" type="module"></script>
</head>
<body>
<h1>Implementing a simple language</h1>
<p>This page demonstrates language implementation techniques using a small formal language with the following grammar.</p>
<pre style="line-height: 200%;"><program> ::= start <statement>* end
<statement> ::= <assignment_statement> | <output_statement>
<assignment_statement> ::= <identifier> = <expression>
<output_statement> ::= print ( <expression> )
<expression> ::= <identifier> | <number>
<identifier> ::= /[a-zA-Z]+[a-zA-Z0-9_]*/
<number> ::= /[0-9]+/</pre>
<p>In addition, comments consisting of any characters starting with <code>/*</code> and ending with <code>*/</code> will be ignored.</p>
<form onsubmit="return false;">
<p>
<textarea rows="7" cols="80" id="code">/* You can edit this sample program. */
start
a = 1
b = a
print(b) /* This prints 1 */
end</textarea>
</p>
<p>
<button type="submit" id="startOver" onclick="location.reload();">Start over</button>
<button type="submit" id="runButton"></button>
</p>
</form>
<div id="result"></div>
</body>
</html>