aboutsummaryrefslogtreecommitdiff
path: root/snug-clean/src/Snug/Syntax.dcl
blob: 865d5f7a2383533eab4eafb88ed7bee69e4606c2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
	| TestDef !String !Type !Expression !String