-
Notifications
You must be signed in to change notification settings - Fork 9
/
test.htm
42 lines (36 loc) · 1.27 KB
/
test.htm
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<title>Haskelltolk i Javascript</title>
<script src="lib/jsparse.js" type="text/javascript"></script>
<script src="haskell.js" type="text/javascript"></script>
<script src="haskell.ast.js" type="text/javascript"></script>
<script src="haskell.parser.js" type="text/javascript"></script>
<script src="haskell.interpreter.js" type="text/javascript"></script>
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
var test1 = "module Test (asd,ysd) where { import Test }";
var test2 = "import Test";
var test3 = <><![CDATA[
module Test where {
cons x y = \f -> f x y;
car f = f (\x y -> x);
cdr f = f (\x y -> y);
main = alert (car (cons 1 2))
}
]]></>.toString()
var test4 = "1 * 3 + 2 * (4 + 1)";
var res = haskell.parser.parse(test3).ast;
var res2 = haskell.interpreter.execute(res);
console.log("%o", res2);
$("#output").text(res2);
});
</script>
</head>
<body>
<div id="output">This is a test page</div>
</body>
</html>