start work on raw syntax

This commit is contained in:
Rachel Lambda Samuelsson 2023-01-25 21:17:49 +01:00
parent c6ebac27ba
commit 00667c11af
2 changed files with 75 additions and 1 deletions

View File

@ -1,5 +1,38 @@
type var = Ix of int
type name = string type name = string
type bind type icit
= Imp = Imp
| Exp | Exp
type ast
= Var of var
| Type
| T0
| Ind0 of ast * ast
| T1
| T1tr (* Unit eta rule instead of elimination principle *)
| TNat
| Zero
| Suc of ast
| IndN of ast * ast * ast * ast
| TBool
| True
| False
| IndB of ast * ast * ast * ast (* ordered true, false *)
| Pi of icit * ast * ast
| Lam of icit * ast
| App of icit * ast
| Sg of ast * ast
| Pair of ast * ast
| Fst of ast
| Snd of ast
| Let of ast * ast * ast (* tr : ty in sc *)

41
lib/Raw/implicitt.cf Normal file
View File

@ -0,0 +1,41 @@
layout toplevel ;
layout "let" ;
layout stop "in" ;
entrypoints [Def], Exp ;
token Id ((letter|digit|["[]_"])+) ;
comment "--" ;
comment "{-" "-}" ;
Assign. Assign ::= Id ":=" Exp ;
separator nonempty Assign ";" ;
BD. BE ::= Id
BD. BI ::= "{" Id "}"
separator nonempty BD "" ;
ExpPiE. Exp ::= "Π" "(" Id ":" Exp ")" Exp
ExpPiI. Exp ::= "Π" "{" Id ":" Exp "}" Exp
ExpSig. Exp ::= "Σ" "(" Id ":" Exp ")" Exp
ExpLet. Exp ::= "let" "{" [Assign] "}" "in" Exp
ExpLam. Exp ::= "λ" [BD] "." Exp
ExpVar. Exp ::= Id
ExpT0. Exp ::= ""
ExpT1. Exp ::= ""
ExpT1tr. Exp ::= ""
ExpTNat. Exp ::= ""
ExpTZero. Exp ::= "0"
ExpTSuc. Exp ::= "S"
ExpTBool. Exp ::= "𝔹"
ExpTTrue. Exp ::= "T"
ExpTFalse. Exp ::= "F"
ExpTPair. Exp ::= "" Exp , Exp ""
ExpTFst. Exp ::= "pr"
ExpTSnd. Exp ::= "pr"
ExpApp. Exp ::= Exp Exp
VarDef. Def ::= "def" Id ":" Exp ":=" Exp
seperator Def ";"