diff --git a/code/compiler/03/bad1.txt b/code/compiler/03/bad1.txt new file mode 100644 index 0000000..86d4bc4 --- /dev/null +++ b/code/compiler/03/bad1.txt @@ -0,0 +1,2 @@ +data Bool = { True, False } +defn main = { 3 + True } diff --git a/code/compiler/03/bad2.txt b/code/compiler/03/bad2.txt new file mode 100644 index 0000000..def8785 --- /dev/null +++ b/code/compiler/03/bad2.txt @@ -0,0 +1 @@ +defn main = { 1 2 3 4 5 } diff --git a/code/compiler/03/works1.txt b/code/compiler/03/works1.txt new file mode 100644 index 0000000..bedb5d8 --- /dev/null +++ b/code/compiler/03/works1.txt @@ -0,0 +1,2 @@ +defn main = { plus 320 6 } +defn plus x y = { x + y } diff --git a/code/compiler/03/works2.txt b/code/compiler/03/works2.txt new file mode 100644 index 0000000..8332fde --- /dev/null +++ b/code/compiler/03/works2.txt @@ -0,0 +1,3 @@ +defn add x y = { x + y } +defn double x = { add x x } +defn main = { double 163 } diff --git a/code/compiler/03/works3.txt b/code/compiler/03/works3.txt new file mode 100644 index 0000000..cfffd20 --- /dev/null +++ b/code/compiler/03/works3.txt @@ -0,0 +1,7 @@ +data List = { Nil, Cons Int List } +defn length l = { + case l of { + Nil -> { 0 } + Cons x xs -> { 1 + length xs } + } +}