];
binder: [
[ SYMBOL <:unicode<lambda>> (* λ *) -> `Lambda
- | SYMBOL <:unicode<pi>> (* π *) -> `Pi
+ | SYMBOL <:unicode<Pi>> (* Π *) -> `Pi
| SYMBOL <:unicode<exists>> (* ∃ *) -> `Exists
- | SYMBOL <:unicode<forall>> (* ∀ *) -> `Forall
- ]
+ | SYMBOL <:unicode<forall>> (* ∀ *) -> `Forall ]
+ ];
+ sort: [
+ [ "Prop" -> `Prop
+ | "Set" -> `Set
+ | "Type" -> `Type
+ | "CProp" -> `CProp ]
];
typed_name: [
[ PAREN "("; i = IDENT; SYMBOL ":"; typ = term; PAREN ")" ->
(head, vars)
]
];
- term0: [ [ t = term -> return_term loc t ] ];
+ term0: [ [ t = term; EOI -> return_term loc t ] ];
term:
- [ "arrow" RIGHTA
- [ t1 = term; SYMBOL <:unicode<to>>; t2 = term ->
- return_term loc
- (CicAst.Binder (`Pi, (Cic.Anonymous, Some t1), t2))
- ]
- | "binder" RIGHTA
+ [ "binder" RIGHTA
[
b = binder;
(vars, typ) =
vars body
in
return_term loc binder
+ | t1 = term; SYMBOL <:unicode<to>> (* → *); t2 = term ->
+ return_term loc
+ (CicAst.Binder (`Pi, (Cic.Anonymous, Some t1), t2))
]
| "eq" LEFTA
[ t1 = term; SYMBOL "="; t2 = term ->
| "mult" LEFTA [ (* nothing here by default *) ]
| "inv" NONA [ (* nothing here by default *) ]
| "simple" NONA
- [
- sort_kind = [
- "Prop" -> `Prop | "Set" -> `Set | "Type" -> `Type | "CProp" -> `CProp
- ] ->
- CicAst.Sort sort_kind
+ [ sort = sort -> CicAst.Sort sort
| n = substituted_name -> return_term loc n
| PAREN "("; head = term; args = LIST1 term; PAREN ")" ->
return_term loc (CicAst.Appl (head :: args))
(** {2 Grammar extensions} *)
-val term: CicAst.term Grammar.Entry.e (** recursive rule *)
-val term0: CicAst.term Grammar.Entry.e (** top level rule *)
+val term: CicAst.term Grammar.Entry.e (** recursive rule *)
+val term0: CicAst.term Grammar.Entry.e (** top level rule *)
val return_term: CicAst.location -> CicAst.term -> CicAst.term