Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. -- | A symbol identifier following the format [a-z][a-zA-Z0-9_-]*
  2. type Identifier = Text
  3.  
  4. -- | 'AST's encode the various types of expressions in the language.
  5. data AST = ASTValue | ASTExpression deriving (Show, Eq)
  6.  
  7. data ASTConjunction = ASTAnd [AST] | ASTOr [AST] deriving (Show, Eq)
  8.  
  9. data ASTValue = ASTRoot [AST] -- ^ A series of sub-ASTs
  10. | ASTLiteral Value -- ^ A literal that does not require evaluation
  11. | ASTFunc Identifier [ASTValue]
  12. -- ^ A function call and list of arguments
  13. | ASTVar Identifier -- ^ Variable dereference
  14. | ASTIndex ASTValue [Identifier] -- ^ Nested index into an object
  15. | ASTArray (V.Vector ASTValue)
  16. -- ^ A literal array (may contain non-literals)
  17. deriving (Show, Eq)
  18.  
  19. data ASTExpression = ASTIf ASTConjunction ASTValue (Maybe ASTValue)
  20. -- ^ If - condition, true branch and optional false branch
  21. | ASTFor (Maybe Identifier) Identifier ASTValue ASTValue (Maybe ASTValue)
  22. -- ^ for([k,]v in expr) body separator
  23. deriving (Show, Eq)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement