This commit is contained in:
pingu 2023-12-10 21:41:13 +01:00
parent 50fae9f452
commit b79b7e8bc7
3 changed files with 68 additions and 0 deletions

1
.gitignore vendored
View File

@ -25,3 +25,4 @@ cabal.project.local~
.direnv/
.envrc
src/Serene/

42
src/Makefile Normal file
View File

@ -0,0 +1,42 @@
## File generated by the BNF Converter (bnfc 2.9.5).
# Makefile for building the parser and test program.
GHC = ghc
HAPPY = happy
HAPPY_OPTS = --array --info --ghc --coerce
ALEX = alex
ALEX_OPTS = --ghc
# List of goals not corresponding to file names.
.PHONY : all clean distclean
# Default goal.
all : Serene/Test
# Rules for building the parser.
Serene/Abs.hs Serene/Lex.x Serene/Par.y Serene/Print.hs Serene/Test.hs : Serene.cf
bnfc --haskell -d Serene.cf
%.hs : %.y
${HAPPY} ${HAPPY_OPTS} $<
%.hs : %.x
${ALEX} ${ALEX_OPTS} $<
Serene/Test : Serene/Abs.hs Serene/Lex.hs Serene/Par.hs Serene/Print.hs Serene/Test.hs
${GHC} ${GHC_OPTS} $@
# Rules for cleaning generated files.
clean :
-rm -f Serene/*.hi Serene/*.o Serene/*.log Serene/*.aux Serene/*.dvi
distclean : clean
-rm -f Serene/Abs.hs Serene/Abs.hs.bak Serene/ComposOp.hs Serene/ComposOp.hs.bak Serene/Doc.txt Serene/Doc.txt.bak Serene/ErrM.hs Serene/ErrM.hs.bak Serene/Layout.hs Serene/Layout.hs.bak Serene/Lex.x Serene/Lex.x.bak Serene/Par.y Serene/Par.y.bak Serene/Print.hs Serene/Print.hs.bak Serene/Skel.hs Serene/Skel.hs.bak Serene/Test.hs Serene/Test.hs.bak Serene/XML.hs Serene/XML.hs.bak Serene/AST.agda Serene/AST.agda.bak Serene/Parser.agda Serene/Parser.agda.bak Serene/IOLib.agda Serene/IOLib.agda.bak Serene/Main.agda Serene/Main.agda.bak Serene/Serene.dtd Serene/Serene.dtd.bak Serene/Test Serene/Lex.hs Serene/Par.hs Serene/Par.info Serene/ParData.hs Makefile
-rmdir -p Serene/
# EOF

View File

@ -0,0 +1,25 @@
Prog. Program ::= [Def];
DTyp. Def ::= Ident ":" [Type];
DDef. Def ::= Ident "=" Exp;
terminator Def "";
separator Type "->";
EVar. Exp4 ::= Ident;
EInt. Exp4 ::= Integer;
EDouble. Exp4 ::= Double;
EApp. Exp3 ::= Exp3 Exp4;
EAdd. Exp2 ::= Exp1 "+" Exp2;
ESub. Exp2 ::= Exp1 "-" Exp2;
EIf. Exp ::= Exp "?" Exp ":" Exp;
EAbs. Exp ::= "\\" Ident "->" Exp;
coercions Exp 4;
comment "#";
TInt. Type ::= "Integer";
TDouble. Type ::= "Double";