From 301a73c63b3fe5e8306e9e8d213269a720b7a089 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 23 Jan 2023 22:36:16 +0100 Subject: Add Clean parser for snug --- snug-clean/src/Snug/Syntax.dcl | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 snug-clean/src/Snug/Syntax.dcl (limited to 'snug-clean/src/Snug/Syntax.dcl') diff --git a/snug-clean/src/Snug/Syntax.dcl b/snug-clean/src/Snug/Syntax.dcl new file mode 100644 index 0000000..d030df6 --- /dev/null +++ b/snug-clean/src/Snug/Syntax.dcl @@ -0,0 +1,39 @@ +definition module Snug.Syntax + +:: TypeIdent :== String +:: TypeVarIdent :== String +:: ConstructorIdent :== String +:: SymbolIdent :== String + +:: Type + = Type !TypeIdent + | TyVar !TypeVarIdent + | TyApp !Type !Type + +:: ConstructorDef + = ConstructorDef !ConstructorIdent ![Type] + +:: BasicValue + = BVInt !Int + | BVChar !Char + +:: Pattern + = Wildcard + | BasicValuePattern !BasicValue + | IdentPattern !SymbolIdent + | ConstructorPattern !ConstructorIdent ![Pattern] + +:: CaseAlternative + = CaseAlternative !Pattern !Expression + +:: Expression + = BasicValue !BasicValue + | Symbol !SymbolIdent + | Constructor !ConstructorIdent + | Case !Expression ![CaseAlternative] + | ExpApp !Expression !Expression + +:: Definition + = DataDef !TypeIdent ![TypeVarIdent] ![ConstructorDef] + | TypeDef !TypeIdent !Type + | FunDef !SymbolIdent ![(SymbolIdent, Type)] !Type !Expression -- cgit v1.2.3