From b79b7e8bc73b027ddd38209f1a0981e120b473e1 Mon Sep 17 00:00:00 2001 From: pingu Date: Sun, 10 Dec 2023 21:41:13 +0100 Subject: [PATCH] Mjapp --- .gitignore | 1 + src/Makefile | 42 ++++++++++++++++++++++++++++++++++++++++++ src/Serene.cf | 25 +++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 src/Makefile diff --git a/.gitignore b/.gitignore index 52ef1dd..cce1a92 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ cabal.project.local~ .direnv/ .envrc +src/Serene/ diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..683a120 --- /dev/null +++ b/src/Makefile @@ -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 diff --git a/src/Serene.cf b/src/Serene.cf index e69de29..ad9782d 100644 --- a/src/Serene.cf +++ b/src/Serene.cf @@ -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";