d8e3c5a0bbaf024fbabccc9a38a1cb62feeb400b
[haskell-directory.git] / Text / ParserCombinators / Parsec / examples / Mondrian / Mondrian.hs
1 {-
2 Abstract Syntax for Core Mondrian
3 (c) 1999 Erik Meijer and Arjan van Yzendoorn
4 -}
5
6 module Mondrian where 
7
8 data CompilationUnit
9   = Package Name [Decl]
10     deriving Show
11
12 data Decl
13  = ClassDecl Name [Name] [Decl]    
14  | ImportDecl Name
15  | VarDecl Name Expr
16  | SigDecl Name Expr
17    deriving Show
18
19 data Expr
20   = Lit Lit
21   | Var Name
22   | Case Expr [(Pattern, Expr)]
23   | Let [Decl] Expr
24   | Lambda [Name] Expr
25   | App Expr Expr
26   | New Name [Decl]
27   | Chain Expr [(Name, Expr)] 
28     deriving Show
29       
30 data Pattern 
31   = Pattern Name [Decl]
32   | Default
33     deriving Show
34   
35 data Lit
36   = IntLit Integer
37   | CharLit Char
38   | StringLit String
39     deriving Show
40     
41 type Name = [String]