2022-09-03 11:06:12 +02:00
|
|
|
|
entrypoints [Def], Term;
|
|
|
|
|
|
|
|
|
|
token Id ((letter|digit|["[]_"])+) ;
|
|
|
|
|
|
|
|
|
|
comment "--" ;
|
|
|
|
|
comment "{-" "-}" ;
|
|
|
|
|
|
|
|
|
|
Defn. Def ::= "def" Id ":" Term ":=" Term;
|
|
|
|
|
separator nonempty Def "" ;
|
|
|
|
|
|
|
|
|
|
-- names bound by lambdas
|
|
|
|
|
NImp. Name ::= "{" Id "}";
|
|
|
|
|
NExp. Name ::= Id;
|
|
|
|
|
separator nonempty Name "" ;
|
|
|
|
|
|
2022-09-03 12:36:13 +02:00
|
|
|
|
-- Term 3
|
|
|
|
|
TType. Term3 ::= "Type";
|
2022-09-03 11:06:12 +02:00
|
|
|
|
|
2022-09-03 12:36:13 +02:00
|
|
|
|
TT0. Term3 ::= "𝟘";
|
|
|
|
|
TInd0. Term3 ::= "𝟘-elim";
|
2022-09-03 11:06:12 +02:00
|
|
|
|
|
2022-09-03 12:36:13 +02:00
|
|
|
|
TT1. Term3 ::= "𝟙";
|
|
|
|
|
TT1tr. Term3 ::= "★";
|
2022-09-03 11:06:12 +02:00
|
|
|
|
|
2022-09-03 12:36:13 +02:00
|
|
|
|
TBool. Term3 ::= "𝟚";
|
|
|
|
|
TTrue. Term3 ::= "true";
|
|
|
|
|
TFalse. Term3 ::= "false";
|
|
|
|
|
TIndB. Term3 ::= "𝟚-elim";
|
2022-09-03 11:06:12 +02:00
|
|
|
|
|
2022-09-03 12:36:13 +02:00
|
|
|
|
TNat. Term3 ::= "ℕ";
|
|
|
|
|
TZero. Term3 ::= "0";
|
|
|
|
|
TSuc. Term3 ::= "suc";
|
|
|
|
|
TIndN. Term3 ::= "ℕ-elim";
|
2022-09-03 11:06:12 +02:00
|
|
|
|
|
2022-09-03 12:36:13 +02:00
|
|
|
|
TFst. Term3 ::= "pr₁";
|
|
|
|
|
TSnd. Term3 ::= "pr₂";
|
2022-09-03 11:06:12 +02:00
|
|
|
|
|
2022-09-03 12:36:13 +02:00
|
|
|
|
TLam. Term3 ::= "λ" [Name] "." Term;
|
2022-09-03 11:06:12 +02:00
|
|
|
|
|
2022-09-03 12:36:13 +02:00
|
|
|
|
TVar. Term3 ::= Id;
|
2022-09-03 11:06:12 +02:00
|
|
|
|
|
2022-09-03 12:36:13 +02:00
|
|
|
|
-- Term2
|
2022-09-03 11:06:12 +02:00
|
|
|
|
|
2022-09-03 12:36:13 +02:00
|
|
|
|
TAppEx. Term2 ::= Term2 Term3;
|
|
|
|
|
TAppIm. Term2 ::= Term2 "{" Term "}";
|
2022-09-03 11:06:12 +02:00
|
|
|
|
|
2022-09-03 12:36:13 +02:00
|
|
|
|
-- Term1
|
|
|
|
|
TPiAr. Term1 ::= Term2 "→" Term1;
|
|
|
|
|
TSgCr. Term1 ::= Term2 "×" Term1;
|
2022-09-03 11:06:12 +02:00
|
|
|
|
|
|
|
|
|
-- Term0
|
|
|
|
|
TLet. Term ::= "let" Id ":" Term ":=" Term "in" Term ;
|
|
|
|
|
|
|
|
|
|
TPiEx. Term ::= "(" Id ":" Term ")" "→" Term;
|
|
|
|
|
TPiIm. Term ::= "{" Id ":" Term "}" "→" Term;
|
|
|
|
|
|
|
|
|
|
TSg. Term ::= "(" Id ":" Term ")" "×" Term;
|
|
|
|
|
TPair. Term ::= "⟨" Term "," Term "⟩";
|
|
|
|
|
|
2022-09-03 12:36:13 +02:00
|
|
|
|
THole. Term ::= "?";
|
2022-09-03 11:06:12 +02:00
|
|
|
|
|
2022-09-03 12:36:13 +02:00
|
|
|
|
coercions Term 3;
|