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 (executable
(public_name implicitt) (public_name implicitt)
(name main) (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 (library
(name Parse) (name Parse)
(libraries Raw)
(flags (:standard -w -27 -w -39 -w -33))) (flags (:standard -w -27 -w -39 -w -33)))
(rule (rule
(alias bnfc)
(deps "implicitt.cf") (deps "implicitt.cf")
(targets AbsImplicitt.ml BNFC_Util.ml LexImplicitt.mll ParImplicitt.mly PrintImplicitt.ml ShowImplicitt.ml SkelImplicitt.ml TestImplicitt.ml) (targets AbsImplicitt.ml BNFC_Util.ml LexImplicitt.mll ParImplicitt.mly PrintImplicitt.ml ShowImplicitt.ml SkelImplicitt.ml TestImplicitt.ml)
(action (run bnfc --ocaml %{deps}))) (action (run bnfc --ocaml %{deps})))
(ocamllex LexImplicitt) (ocamllex LexImplicitt)
(ocamlyacc ParImplicitt) (ocamlyacc ParImplicitt)

View File

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