000001| (** Labelled AST for Lua *)
000002|
000003| type pos = {
000004| lex_pos : Lexing.position;
000005| func : int option;
000006| line_label : int;
000007| }
000008|
000009| type label = int
000010|
000011| type lit =
000012| | Nil
000013| | Bool of bool
000014| | String of Ast.str
000015| | Number of Ast.number (*float*)
000016| | Table of label(*NEW*) * exp list * (string * exp) list
000017| | Fun of label(*NEW*) * string list * block * label(*NEW*) (*fixme: pos*)
000018|
000019| and lvalue =
000020| | Name of string
000021| | DynIndex of label(*NEW*) * exp * exp
000022|
000023| and exp =
000024| | Lit of lit
000025| | Lvalue of lvalue
000026| | Unop of Ast.unop * exp
000027| | Binop of label(*NEW*) * exp * Ast.binop * exp
000028| | And of exp * exp
000029| | Or of exp * exp
000030| | Call of label(*NEW*) * exp * exp list
000031| | Methcall of label(*NEW*) * label(*NEW*) * exp * string * exp list (* second label for exp:string lvalue *)
000032| | Paren of exp
000033|
000034| and stmt = { stmt_pos : pos;
000035| stmt : stmt_desc }
000036| and stmt_desc =
000037| | Break
000038| | If of exp * block * block
000039| | WhileDo of exp * block * label
000040| (* | For of string * exp * exp * block *)
000041| | Doend of block
000042| | Assign of lvalue list * exp list
000043| | Local of string list * exp list
000044| | Callstmt of exp * exp list
000045| | Methcallstmt of label(*NEW*) * exp * string * exp list
000046| | Return of exp list
000047|
000048| and block = block_desc option
000049| and block_desc = { label : label;
000050| stmts : stmt list }
000051|
000052| type last = {
000053| name : string option;
000054| last : block;
000055| ret_label : label;
000056| pos_map : (label * stmt) list;
000057| fun_map : label -> lit;
000058| table_map : label -> lit;
000059| }