Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanBrouwer committed Jun 7, 2024
1 parent 7393d27 commit 10b90d6
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 5 deletions.
20 changes: 20 additions & 0 deletions prism-compiler/programs/ok/church_bools.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### Input
// Bool = (T: Type) -> T -> T -> T
let Type -> #0 -> #1 -> #2;
// false (left)
let Type => #0 => #1 => #1;
// true (right)
let Type => #0 => #1 => #0;
// and : Bool -> Bool -> Bool
// = v1:Bool => v2:Bool => T:Type => t1:T => t2:T => (v1 T t1 (v2 T t1 t2))
let #2 => #3 => Type => #0 => #1 => #4 #2 #1 (#3 #2 #1 #0);

// and true true
#0 #1 #1

### Eval
Type => #0 => #1 => #0

### Type
Type -> #0 -> #1 -> #2

Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
let Type -> #0 -> (#1 -> #2) -> #2;
let Type => #0 => (#1 -> #2) => #1;
let #1 => Type => #0 => (#1 -> #2) => #0 (#3 #2 #1 #0);
#1 #0
#0 #1

### Eval
Type -> #0 -> (#1 -> #2) -> #2
Type => #0 => (#1 -> #2) => #0 1

### Type
Type => #0 => (#1 -> #2) => #0 #1
Type -> #0 -> (#1 -> #2) -> #2

5 changes: 4 additions & 1 deletion prism-compiler/resources/grammar
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ rule expr {
}
}

rule layout = [' ' | '\n'];
rule layout {
[' ' | '\n'];
"//" [^'\n']* "\n";
}
9 changes: 8 additions & 1 deletion prism-compiler/resources/program.pr
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
Type
// Nat : (T:Type) -> zero:T -> succ:(T->T) -> T
let Type -> #0 -> (#1 -> #2) -> #2;
// zero : Nat
let Type => #0 => (#1 -> #2) => #1;
// add1 : Nat -> Nat
// = (v:Nat) => (T:Type) => zero:T => succ:(T->T) => succ (v T zero succ)
let #1 => Type => #0 => (#1 -> #2) => #0 (#3 #2 #1 #0);
#0 #1

0 comments on commit 10b90d6

Please sign in to comment.