Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- | A symbol identifier following the format [a-z][a-zA-Z0-9_-]*
- type Identifier = Text
- -- | 'AST's encode the various types of expressions in the language.
- data AST = ASTValue | ASTExpression deriving (Show, Eq)
- data ASTConjunction = ASTAnd [AST] | ASTOr [AST] deriving (Show, Eq)
- data ASTValue = ASTRoot [AST] -- ^ A series of sub-ASTs
- | ASTLiteral Value -- ^ A literal that does not require evaluation
- | ASTFunc Identifier [ASTValue]
- -- ^ A function call and list of arguments
- | ASTVar Identifier -- ^ Variable dereference
- | ASTIndex ASTValue [Identifier] -- ^ Nested index into an object
- | ASTArray (V.Vector ASTValue)
- -- ^ A literal array (may contain non-literals)
- deriving (Show, Eq)
- data ASTExpression = ASTIf ASTConjunction ASTValue (Maybe ASTValue)
- -- ^ If - condition, true branch and optional false branch
- | ASTFor (Maybe Identifier) Identifier ASTValue ASTValue (Maybe ASTValue)
- -- ^ for([k,]v in expr) body separator
- deriving (Show, Eq)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement