I hate grammers

This commit is contained in:
Rachel Lambda Samuelsson 2022-09-03 12:36:13 +02:00
parent 96787c4aad
commit 60f620c00e
6 changed files with 38 additions and 28 deletions

View File

@ -1,4 +1,4 @@
(executable
(public_name implicitt)
(name main)
(libraries implicitt))
(libraries Core Raw Parse))

4
lib/Parse/PostProcess.ml Normal file
View File

@ -0,0 +1,4 @@
open Raw
module A = AbsImplicitt
module R = RawSyntax

View File

@ -1,10 +1,12 @@
(library
(name Parse)
(libraries Raw)
(flags (:standard -w -27 -w -39 -w -33)))
(rule
(alias bnfc)
(deps "implicitt.cf")
(targets AbsImplicitt.ml BNFC_Util.ml LexImplicitt.mll ParImplicitt.mly PrintImplicitt.ml ShowImplicitt.ml SkelImplicitt.ml TestImplicitt.ml)
(action (run bnfc --ocaml %{deps})))
(ocamllex LexImplicitt)
(ocamlyacc ParImplicitt)

View File

@ -13,48 +13,50 @@ NImp. Name ::= "{" Id "}";
NExp. Name ::= Id;
separator nonempty Name "" ;
-- Term 2
TVar. Term2 ::= Id;
-- Term 3
TType. Term3 ::= "Type";
TType. Term2 ::= "Type";
TT0. Term3 ::= "𝟘";
TInd0. Term3 ::= "𝟘-elim";
TT0. Term2 ::= "𝟘";
TT1. Term3 ::= "𝟙";
TT1tr. Term3 ::= "";
TT1. Term2 ::= "𝟙";
TT1tr. Term2 ::= "";
TBool. Term3 ::= "𝟚";
TTrue. Term3 ::= "true";
TFalse. Term3 ::= "false";
TIndB. Term3 ::= "𝟚-elim";
TBool. Term2 ::= "𝟚";
TTrue. Term2 ::= "true";
TFalse. Term2 ::= "false";
TNat. Term3 ::= "";
TZero. Term3 ::= "0";
TSuc. Term3 ::= "suc";
TIndN. Term3 ::= "-elim";
TNat. Term2 ::= "";
TZero. Term2 ::= "0";
TFst. Term3 ::= "pr";
TSnd. Term3 ::= "pr";
TLam. Term2 ::= "λ" [Name] "." Term;
TLam. Term3 ::= "λ" [Name] "." Term;
TVar. Term3 ::= Id;
-- Term2
TAppEx. Term2 ::= Term2 Term3;
TAppIm. Term2 ::= Term2 "{" Term "}";
-- Term1
TInd0. Term1 ::= "𝟘-elim" Term2 Term2;
TIndB. Term1 ::= "𝟚-elim" Term2 Term2 Term2 Term2;
TSuc. Term1 ::= "suc" Term2;
TIndN. Term1 ::= "-elim" Term2 Term2 Term2 Term2;
TFst. Term1 ::= "pr" Term2;
TSnd. Term1 ::= "pr" Term2;
TApp. Term1 ::= Term1 Term2;
TPiAr. Term1 ::= Term2 "" Term1;
TSgCr. Term1 ::= Term2 "×" Term1;
-- Term0
TLet. Term ::= "let" Id ":" Term ":=" Term "in" Term ;
TPiAr. Term ::= Term "" Term;
TPiEx. Term ::= "(" Id ":" Term ")" "" Term;
TPiIm. Term ::= "{" Id ":" Term "}" "" Term;
TSgCr. Term ::= Term "×" Term;
TSg. Term ::= "(" Id ":" Term ")" "×" Term;
TPair. Term ::= "" Term "," Term "";
THole. Term ::= "?";
coercions Term 2;
coercions Term 3;

0
lib/Raw/RawSyntax.ml Normal file
View File

2
lib/Raw/dune Normal file
View File

@ -0,0 +1,2 @@
(library
(name Raw))