-
Notifications
You must be signed in to change notification settings - Fork 0
/
LuaAS.hs
44 lines (35 loc) · 1.01 KB
/
LuaAS.hs
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
module LuaAS where
import Text.ParserCombinators.Parsec.Pos
type Name = String
data LValue = LVar Name
| LFieldRef Expr Expr
deriving Show
data Expr = Number Double
| StringLiteral SourcePos String
| Bool Bool
| Nil
| Ellipsis
| Call Expr [Expr]
| MemberCall Expr Name [Expr]
| TableCons [(Maybe Expr, Expr)]
| UnOp String Expr
| BinOp String Expr Expr
| FieldRef Expr Expr
| Var Name
deriving Show
data Stmt = Do Block
| While Expr Block
| Until Expr Block
| If [(Expr, Block)] (Maybe Block)
| Function [[Name]] Block
| Return [Expr]
| Break
| For [Name] ForGen Block
| Assignment [LValue] [Expr]
| LocalDef [Name] [Expr]
deriving Show
data ForGen = ForNum Expr Expr (Maybe Expr)
| ForIter [Expr]
deriving Show
data Block = Block [Stmt]
deriving Show