aboutsummaryrefslogtreecommitdiff
path: root/snug-clean/src/Snug/Syntax.dcl
diff options
context:
space:
mode:
Diffstat (limited to 'snug-clean/src/Snug/Syntax.dcl')
-rw-r--r--snug-clean/src/Snug/Syntax.dcl39
1 files changed, 39 insertions, 0 deletions
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