-
Notifications
You must be signed in to change notification settings - Fork 0
/
interpretertest.html
35 lines (28 loc) · 985 Bytes
/
interpretertest.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
<!DOCTYPE html>
<html>
<head>
<title>DSC Interpreter Test</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript" src="interpreter.js"></script>
<script type="text/javascript">
$(document).ready(function() {
/* Test Implementation of the interpreter */
var spells_toks = new Array();
spell = 'accelerate 1 cursor, if (steps > 0) (semi_homing (steps - 1)) (accelerate 1 cursor)';
spells_toks = scan(spell);
console.log("Starting SCAN");
for(var i = 0; i < spells_toks.length;i++) {
console.log('tok[' + i + ']: ' + spells_toks[i].get_lex_name());
}
console.log("Ending SCAN\n");
console.log("Starting PARSE");
var root_node = parse(spells_toks);
console.log("Ending PARSE\n");
tree_str = root_node.toString();
console.log('traversal : ' + tree_str);
});
</script>
</head>
<body>
</body>
</html>