Skip to content

Commit 9ecbf2a

Browse files
author
jchen293
committedMay 22, 2019
CSE305 OCaml Interpreter Project
0 parents  commit 9ecbf2a

27 files changed

+2967
-0
lines changed
 

‎backup.ml

+1,256
Large diffs are not rendered by default.

‎input/sample_input1.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pushn x
2+
pushi 4
3+
pop
4+
pushb :true:
5+
pushb :false:
6+
and
7+
not
8+
pushb :false:
9+
or
10+
pushi 3
11+
quit

‎input/sample_input10.txt

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
pushn a
2+
pushi 30
3+
pushn a
4+
pushi 7
5+
bind
6+
pop
7+
pushn a
8+
pushi 1
9+
rem
10+
pushi 5
11+
pushn a
12+
rem
13+
pushn a
14+
pushb :true:
15+
bind
16+
pushn a
17+
pushn a
18+
and
19+
pushn a
20+
or
21+
pushn a
22+
pushb :false:
23+
bind
24+
pushb :true:
25+
pushn a
26+
and
27+
pushn a
28+
or
29+
pushn bob
30+
pushs "Bob Vance "
31+
bind
32+
pushn fridge
33+
pushs "Vance Refrigeration"
34+
bind
35+
pushn bob
36+
pushn fridge
37+
cat
38+
let
39+
pushn fridge
40+
end
41+
pushs "."
42+
cat
43+
quit

‎input/sample_input2.txt

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
pushn a
2+
pushi 8
3+
pushi 10
4+
equal
5+
pushi 10
6+
pushi 100
7+
lessThan
8+
pushn name1
9+
quit

‎input/sample_input3.txt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
pushn c
2+
pushn a
3+
pushi 5
4+
bind
5+
pushn b
6+
pushi 10
7+
bind
8+
pushn a
9+
pushn b
10+
add
11+
pushi 3
12+
div
13+
quit

‎input/sample_input4.txt

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
let
2+
pushi 51
3+
end
4+
pop
5+
let
6+
pushn c
7+
pushi 13
8+
bind
9+
let
10+
pushn a
11+
pushi 5
12+
bind
13+
pushn a
14+
pushn c
15+
add
16+
end
17+
let
18+
pushn b
19+
pushs "joker"
20+
bind
21+
end
22+
end
23+
pushi 40
24+
pushi 4
25+
rem
26+
quit

‎input/sample_input5.txt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
pushn x
2+
let
3+
pushi 5
4+
pushi -12345
5+
add
6+
end
7+
let
8+
pushi 010
9+
pushi -13
10+
add
11+
end
12+
div
13+
quit

‎input/sample_input6.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
pushn unused
2+
pushi -23
3+
bind
4+
pushi 100
5+
pushn n1
6+
swap
7+
bind
8+
let
9+
pushn n2
10+
pushn n1
11+
bind
12+
pushn n2
13+
neg
14+
neg
15+
end
16+
pushn n2
17+
neg
18+
pushn n1
19+
neg
20+
div
21+
quit

‎input/sample_input7.txt

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
pushn _global_1
2+
pushi 10
3+
pop
4+
pushi -40
5+
pop
6+
pushs " let's get small "
7+
pushs " steve martin "
8+
cat
9+
pushn a
10+
pushi 3
11+
bind
12+
pushn b
13+
pushi 5
14+
bind
15+
pushn IsUnit
16+
swap
17+
bind
18+
pushn a
19+
pushn b
20+
mul
21+
pushi 11
22+
lessThan
23+
pushn FALSEmaybe
24+
swap
25+
bind
26+
pushn FALSEmaybe
27+
pushb :false:
28+
or
29+
pushs "FALSEmaybe is"
30+
pushn IsUnit
31+
pushi -151
32+
bind
33+
pop
34+
pushn IsUnit
35+
neg
36+
pushs " b e y o n d t h e p a l e _ "
37+
pushs "Jimmothy Gaffigan"
38+
cat
39+
pushi 42
40+
pushi 23
41+
quit

‎input/sample_input8.txt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
pushn b
2+
pushi 3
3+
bind
4+
let
5+
pushn b
6+
pushi 5
7+
bind
8+
pushn b
9+
pushn b
10+
mul
11+
end
12+
push :unit:
13+
quit

‎input/sample_input9.txt

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
pushi 4.0
2+
pushn a
3+
pushb :true:
4+
bind
5+
pushn b
6+
pushb :false:
7+
bind
8+
pushn c
9+
pushb :true:
10+
bind
11+
pushn d
12+
pushb :false:
13+
bind
14+
pushn a
15+
pushn c
16+
and
17+
pushn d
18+
or
19+
not
20+
pushn a
21+
and
22+
pushb :true:
23+
or
24+
pushi 10
25+
pushi 5
26+
if
27+
pushn e
28+
swap
29+
bind
30+
pushn e
31+
pushn e
32+
mul
33+
quit

‎interpreter.cmi

1.63 KB
Binary file not shown.

‎interpreter.cmo

99.6 KB
Binary file not shown.

‎interpreter.ml

+1,422
Large diffs are not rendered by default.

‎output.txt

Whitespace-only changes.

‎output/sample_output1.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
3
2+
:true:
3+
x

‎output/sample_output10.txt

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Vance Refrigeration.
2+
Bob Vance Vance Refrigeration
3+
:unit:
4+
:unit:
5+
:false:
6+
:unit:
7+
:true:
8+
:unit:
9+
5
10+
0
11+
30
12+
a

‎output/sample_output2.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name1
2+
:true:
3+
:false:
4+
a

‎output/sample_output3.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
5
2+
:unit:
3+
:unit:
4+
c

‎output/sample_output4.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
0
2+
:unit:

‎output/sample_output5.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
4113
2+
x

‎output/sample_output6.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
:error:
2+
-100
3+
:error:
4+
n2
5+
100
6+
:unit:
7+
:unit:

‎output/sample_output7.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
23
2+
42
3+
b e y o n d t h e p a l e _ Jimmothy Gaffigan
4+
151
5+
FALSEmaybe is
6+
:false:
7+
:unit:
8+
:unit:
9+
:unit:
10+
let's get small steve martin
11+
_global_1

‎output/sample_output8.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:unit:
2+
25
3+
:unit:

‎output/sample_output9.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
25
2+
:unit:
3+
:unit:
4+
:unit:
5+
:unit:
6+
:unit:
7+
:error:

‎package-lock.json

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎part1

138 KB
Binary file not shown.

0 commit comments

Comments
 (0)
Please sign in to comment.