Skip to content

Commit

Permalink
Restore example program.pr
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanBrouwer committed Jul 6, 2024
1 parent d83d4cd commit b66c0a5
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions prism-compiler/resources/program.pr
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
let Bool = (T: Type) -> T -> T -> T;
let true = (T: Type) => (v1: T) => (v2: T) => v1;
let false = (T: Type) => (v1: T) => (v2: T) => v2;

grammar {
rule expr {
group base {
x <- "$" x:#this;
group or {
e1 Bool true e2 <- e1:#this "||" e2:#next;
}
group and {
e1 Bool e2 false <- e1:#this "&&" e2:#next;
}
}
};
let z = Type -> Type;
grammar {
rule expr {
group base {
$z <- "%" x:#this;
b _ e1 e2 <- "if" b:expr "{" e1:expr "}" "else" "{" e2:expr "}";
b Bool false true <- "!" b:#this;
}
}
rule keyword {
"if";
}

};
let y = Type;
%y

let x = false;

if true && x || !false {
true
} else {
false
}

0 comments on commit b66c0a5

Please sign in to comment.