type token = | EOF | SEMI | SCALAR | LIST | WHILE | IDENT of (string) | BINARY_OP of (string) | LEFT_PAREN | RIGHT_PAREN | LEFT_CURLEY | RIGHT_CURLEY | LEFT_BRACKET | RIGHT_BRACKET | CONST of (string) open Parsing;; # 11 "parser.mly" let debug msg = print_string msg; print_newline() let debug msg = () # 24 "parser.ml" let yytransl_const = [| 0 (* EOF *); 257 (* SEMI *); 258 (* SCALAR *); 259 (* LIST *); 260 (* WHILE *); 263 (* LEFT_PAREN *); 264 (* RIGHT_PAREN *); 265 (* LEFT_CURLEY *); 266 (* RIGHT_CURLEY *); 267 (* LEFT_BRACKET *); 268 (* RIGHT_BRACKET *); 0|] let yytransl_block = [| 261 (* IDENT *); 262 (* BINARY_OP *); 269 (* CONST *); 0|] let yylhs = "\255\255\ \001\000\001\000\001\000\001\000\001\000\004\000\002\000\005\000\ \005\000\005\000\005\000\005\000\003\000\008\000\006\000\006\000\ \007\000\007\000\007\000\009\000\009\000\000\000" let yylen = "\002\000\ \002\000\003\000\002\000\002\000\001\000\003\000\001\000\003\000\ \001\000\003\000\001\000\001\000\001\000\005\000\004\000\003\000\ \003\000\002\000\002\000\004\000\003\000\002\000" let yydefred = "\000\000\ \000\000\000\000\005\000\000\000\000\000\000\000\000\000\000\000\ \000\000\011\000\022\000\000\000\000\000\000\000\009\000\012\000\ \013\000\001\000\000\000\019\000\000\000\000\000\000\000\000\000\ \004\000\000\000\000\000\017\000\000\000\016\000\000\000\008\000\ \002\000\000\000\000\000\000\000\015\000\000\000\000\000\014\000\ \020\000\000\000\006\000" let yydgoto = "\002\000\ \011\000\012\000\013\000\040\000\014\000\015\000\016\000\017\000\ \028\000" let yysindex = "\005\000\ \001\000\000\000\000\000\001\000\254\254\009\255\008\255\012\255\ \021\255\000\000\000\000\026\255\001\000\031\255\000\000\000\000\ \000\000\000\000\037\255\000\000\021\255\005\255\023\255\001\000\ \000\000\021\255\021\255\000\000\035\255\000\000\039\255\000\000\ \000\000\031\255\255\254\033\255\000\000\037\255\001\000\000\000\ \000\000\041\255\000\000" let yyrindex = "\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\048\255\000\000\000\000\ \000\000\000\000\024\255\000\000\000\000\000\000\000\000\002\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\038\255\000\000\000\000\000\000\032\255\000\000\000\000\ \000\000\000\000\000\000" let yygindex = "\000\000\ \252\255\000\000\000\000\000\000\251\255\000\000\000\000\000\000\ \014\000" let yytablesize = 270 let yytable = "\018\000\ \003\000\003\000\019\000\023\000\026\000\001\000\005\000\006\000\ \025\000\008\000\038\000\009\000\030\000\020\000\021\000\029\000\ \031\000\010\000\022\000\033\000\034\000\035\000\005\000\006\000\ \018\000\008\000\024\000\009\000\026\000\018\000\032\000\018\000\ \021\000\010\000\042\000\018\000\026\000\021\000\010\000\021\000\ \026\000\039\000\036\000\021\000\026\000\010\000\037\000\027\000\ \007\000\010\000\043\000\041\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\004\000\005\000\006\000\007\000\008\000\000\000\009\000\ \000\000\000\000\000\000\003\000\000\000\010\000" let yycheck = "\004\000\ \000\000\000\000\005\001\009\000\006\001\001\000\002\001\003\001\ \013\000\005\001\012\001\007\001\008\001\005\001\007\001\021\000\ \022\000\013\001\007\001\024\000\026\000\027\000\002\001\003\001\ \001\001\005\001\001\001\007\001\006\001\006\001\008\001\008\001\ \001\001\013\001\039\000\012\001\006\001\006\001\001\001\008\001\ \006\001\009\001\008\001\012\001\006\001\008\001\008\001\011\001\ \001\001\012\001\010\001\038\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\001\001\002\001\003\001\004\001\005\001\255\255\007\001\ \255\255\255\255\255\255\010\001\255\255\013\001" let yynames_const = "\ EOF\000\ SEMI\000\ SCALAR\000\ LIST\000\ WHILE\000\ LEFT_PAREN\000\ RIGHT_PAREN\000\ LEFT_CURLEY\000\ RIGHT_CURLEY\000\ LEFT_BRACKET\000\ RIGHT_BRACKET\000\ " let yynames_block = "\ IDENT\000\ BINARY_OP\000\ CONST\000\ " let yyact = [| (fun _ -> failwith "parser") ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 0 : Pnode.block) in Obj.repr( # 55 "parser.mly" ( _2 ) # 187 "parser.ml" : Pnode.block)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 2 : 'statement) in let _3 = (Parsing.peek_val __caml_parser_env 0 : Pnode.block) in Obj.repr( # 57 "parser.mly" ( debug "statement-semi-block" ; _1::_3 ) # 195 "parser.ml" : Pnode.block)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 1 : 'statement) in Obj.repr( # 59 "parser.mly" ( debug "statement" ; _1::[] ) # 202 "parser.ml" : Pnode.block)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 1 : 'loop) in let _2 = (Parsing.peek_val __caml_parser_env 0 : Pnode.block) in Obj.repr( # 61 "parser.mly" ( debug "loop" ; _1::_2 ) # 210 "parser.ml" : Pnode.block)) ; (fun __caml_parser_env -> Obj.repr( # 63 "parser.mly" ( [] ) # 216 "parser.ml" : Pnode.block)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 1 : Pnode.block) in Obj.repr( # 67 "parser.mly" ( debug "Code Block" ; _2 ) # 223 "parser.ml" : 'code_block)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'expression) in Obj.repr( # 71 "parser.mly" ( debug "expression" ; _1 ) # 230 "parser.ml" : 'statement)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 1 : 'expression) in Obj.repr( # 75 "parser.mly" ( _2 ) # 237 "parser.ml" : 'expression)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'function_call) in Obj.repr( # 77 "parser.mly" ( debug "function call" ; _1 ) # 244 "parser.ml" : 'expression)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expression) in let _2 = (Parsing.peek_val __caml_parser_env 1 : string) in let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expression) in Obj.repr( # 79 "parser.mly" ( debug ("BinOp " ^ _2) ; Pnode.Binop(_2,_1,_3) ) # 253 "parser.ml" : 'expression)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in Obj.repr( # 81 "parser.mly" ( Pnode.Const(_1) ) # 260 "parser.ml" : 'expression)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'identifier) in Obj.repr( # 83 "parser.mly" ( _1 ) # 267 "parser.ml" : 'expression)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'while_loop) in Obj.repr( # 87 "parser.mly" ( _1 ) # 274 "parser.ml" : 'loop)) ; (fun __caml_parser_env -> let _3 = (Parsing.peek_val __caml_parser_env 2 : 'expression) in let _5 = (Parsing.peek_val __caml_parser_env 0 : 'code_block) in Obj.repr( # 91 "parser.mly" ( debug "while" ; Pnode.Loop("while",[_3],_5,[]) ) # 282 "parser.ml" : 'while_loop)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 3 : string) in let _3 = (Parsing.peek_val __caml_parser_env 1 : 'expression) in Obj.repr( # 95 "parser.mly" ( Pnode.Apply(_1,_3) ) # 290 "parser.ml" : 'function_call)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 2 : string) in Obj.repr( # 97 "parser.mly" ( Pnode.Apply(_1,Pnode.Nothing) ) # 297 "parser.ml" : 'function_call)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 1 : string) in let _3 = (Parsing.peek_val __caml_parser_env 0 : 'subscript) in Obj.repr( # 101 "parser.mly" ( debug (Printf.sprintf "Pnode.ListAt(%s,)" _2 ); Pnode.ListAt(_2,_3) ) # 306 "parser.ml" : 'identifier)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 0 : string) in Obj.repr( # 104 "parser.mly" ( debug ("Scalar " ^ _2) ; Pnode.ScalarVar(_2) ) # 313 "parser.ml" : 'identifier)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 0 : string) in Obj.repr( # 106 "parser.mly" ( debug ("List " ^ _2) ; Pnode.ListVar(_2) ) # 320 "parser.ml" : 'identifier)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 2 : 'expression) in let _4 = (Parsing.peek_val __caml_parser_env 0 : 'subscript) in Obj.repr( # 110 "parser.mly" ( _2::_4 ) # 328 "parser.ml" : 'subscript)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 1 : 'expression) in Obj.repr( # 112 "parser.mly" ( _2::[] ) # 335 "parser.ml" : 'subscript)) (* Entry block *) ; (fun __caml_parser_env -> raise (Parsing.YYexit (Parsing.peek_val __caml_parser_env 0))) |] let yytables = { Parsing.actions=yyact; Parsing.transl_const=yytransl_const; Parsing.transl_block=yytransl_block; Parsing.lhs=yylhs; Parsing.len=yylen; Parsing.defred=yydefred; Parsing.dgoto=yydgoto; Parsing.sindex=yysindex; Parsing.rindex=yyrindex; Parsing.gindex=yygindex; Parsing.tablesize=yytablesize; Parsing.table=yytable; Parsing.check=yycheck; Parsing.error_function=parse_error; Parsing.names_const=yynames_const; Parsing.names_block=yynames_block } let block (lexfun : Lexing.lexbuf -> token) (lexbuf : Lexing.lexbuf) = (Parsing.yyparse yytables 1 lexfun lexbuf : Pnode.block)