SaplStruct.dcl 1.19 KB
Newer Older
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 41 42 43 44 45 46 47 48
definition module Sapl.SaplStruct

import StdString, StdOverloaded
import Sapl.SaplTokenizer
import Data.Maybe

/**
* Possible function types and language constructs.
*/
:: FuncType = FTRecord SaplVar [SaplVar]
			| FTADT SaplVar [SaplConstructor]
			| FTCAF SaplVar SaplTerm
			| FTMacro SaplVar SaplTerm [SaplVar]
			| FTFunc SaplVar SaplTerm [SaplVar]

:: SaplConstructor 	= SaplConstructor SaplVar Int [SaplVar]

:: SaplTerm = SLit Literal
			| SVar SaplVar
			| SApplication SaplVar [SaplTerm]
			| SIf SaplTerm SaplTerm SaplTerm
			| SSelect SaplTerm [(SaplPattern, SaplTerm)]
			| SLet SaplTerm [SaplLetDef]
			| SAbortBody			

:: SaplLetDef = SaplLetDef SaplVar SaplTerm

:: SaplVar = NormalVar String Int 
		   | StrictVar String Int

:: SaplPattern = PCons String [SaplVar]
			   | PLit Literal
			   | PDefault

instance ==	SaplVar
instance <	SaplVar			

eqStrictVar :: !String !SaplVar -> Bool
isStrictVar :: !SaplVar -> Bool
toNormalVar :: !SaplVar -> SaplVar
toStrictVar :: !SaplVar -> SaplVar

unpackVar      :: !SaplVar -> String
unpackBindVar  :: !SaplLetDef -> SaplVar
unpackConsName :: !SaplPattern -> Maybe String

isConsPattern :: !SaplPattern -> Bool