type token = | INT of (int) | IDENT of (string) | LET | IN | EQUAL | LAMBDA | LPAREN | RPAREN | DOT | EOF | SEMI | POUND open Parsing;; # 9 "parser.mly" (* This is where ocaml declarations go *) (* open Node *) # 20 "parser.ml" let yytransl_const = [| 259 (* LET *); 260 (* IN *); 261 (* EQUAL *); 262 (* LAMBDA *); 263 (* LPAREN *); 264 (* RPAREN *); 265 (* DOT *); 0 (* EOF *); 266 (* SEMI *); 267 (* POUND *); 0|] let yytransl_block = [| 257 (* INT *); 258 (* IDENT *); 0|] let yylhs = "\255\255\ \001\000\001\000\001\000\001\000\002\000\004\000\004\000\003\000\ \003\000\005\000\005\000\005\000\005\000\005\000\007\000\007\000\ \006\000\006\000\000\000" let yylen = "\002\000\ \003\000\003\000\002\000\001\000\004\000\006\000\001\000\001\000\ \001\000\001\000\002\000\001\000\003\000\001\000\004\000\002\000\ \002\000\002\000\002\000" let yydefred = "\000\000\ \000\000\000\000\012\000\010\000\000\000\000\000\000\000\004\000\ \000\000\000\000\019\000\000\000\000\000\000\000\000\000\014\000\ \000\000\000\000\000\000\007\000\016\000\000\000\003\000\011\000\ \000\000\000\000\018\000\017\000\000\000\000\000\000\000\013\000\ \001\000\002\000\005\000\015\000\000\000\000\000\000\000\006\000" let yydgoto = "\002\000\ \011\000\012\000\020\000\021\000\014\000\015\000\016\000" let yysindex = "\009\000\ \001\000\000\000\000\000\000\000\012\255\028\255\039\255\000\000\ \001\000\019\255\000\000\016\255\022\255\042\255\042\255\000\000\ \017\255\024\255\036\255\000\000\000\000\044\255\000\000\000\000\ \001\000\001\000\000\000\000\000\039\255\039\255\049\255\000\000\ \000\000\000\000\000\000\000\000\042\255\043\255\039\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\013\255\047\255\000\000\ \000\000\005\255\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" let yygindex = "\000\000\ \249\255\000\000\255\255\254\255\245\255\000\000\000\000" let yytablesize = 268 let yytable = "\013\000\ \008\000\023\000\027\000\028\000\022\000\010\000\010\000\013\000\ \010\000\001\000\010\000\010\000\010\000\017\000\010\000\010\000\ \008\000\033\000\034\000\024\000\008\000\029\000\008\000\013\000\ \013\000\025\000\035\000\036\000\003\000\018\000\019\000\026\000\ \030\000\006\000\007\000\038\000\040\000\031\000\010\000\003\000\ \004\000\019\000\003\000\004\000\006\000\007\000\039\000\006\000\ \007\000\010\000\009\000\032\000\010\000\037\000\009\000\000\000\ \009\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\003\000\004\000\005\000\000\000\000\000\006\000\007\000\ \000\000\000\000\009\000\010\000" let yycheck = "\001\000\ \000\000\009\000\014\000\015\000\007\000\001\001\002\001\009\000\ \004\001\001\000\006\001\007\001\008\001\002\001\010\001\011\001\ \004\001\025\000\026\000\001\001\008\001\005\001\010\001\025\000\ \026\000\010\001\029\000\030\000\001\001\002\001\003\001\010\001\ \009\001\006\001\007\001\037\000\039\000\002\001\011\001\001\001\ \002\001\003\001\001\001\002\001\006\001\007\001\004\001\006\001\ \007\001\011\001\004\001\008\001\011\001\005\001\008\001\255\255\ \010\001\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\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\255\255\255\255\006\001\007\001\ \255\255\255\255\010\001\011\001" let yynames_const = "\ LET\000\ IN\000\ EQUAL\000\ LAMBDA\000\ LPAREN\000\ RPAREN\000\ DOT\000\ EOF\000\ SEMI\000\ POUND\000\ " let yynames_block = "\ INT\000\ IDENT\000\ " let yyact = [| (fun _ -> failwith "parser") ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 2 : 'declaration) in let _3 = (Parsing.peek_val __caml_parser_env 0 : Lambda.exp list) in Obj.repr( # 26 "parser.mly" ( _3 ) # 175 "parser.ml" : Lambda.exp list)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expression) in let _3 = (Parsing.peek_val __caml_parser_env 0 : Lambda.exp list) in Obj.repr( # 27 "parser.mly" ( _1::_3 ) # 183 "parser.ml" : Lambda.exp list)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 0 : Lambda.exp list) in Obj.repr( # 28 "parser.mly" ( _2 ) # 190 "parser.ml" : Lambda.exp list)) ; (fun __caml_parser_env -> Obj.repr( # 29 "parser.mly" ( [] ) # 196 "parser.ml" : Lambda.exp list)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 2 : string) in let _4 = (Parsing.peek_val __caml_parser_env 0 : 'dexp) in Obj.repr( # 33 "parser.mly" ( (*print_string "Parsed: "; Lambda.print $4; print_newline();*) Lambda.var_env := (_2,_4)::!Lambda.var_env ) # 209 "parser.ml" : 'declaration)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 4 : string) in let _4 = (Parsing.peek_val __caml_parser_env 2 : 'expression) in let _6 = (Parsing.peek_val __caml_parser_env 0 : 'dexp) in Obj.repr( # 42 "parser.mly" ( (*print_string "Parsed sub exp"; print_newline();*) Lambda.Apply(Lambda.Lambda(_2,_6),_4) ) # 222 "parser.ml" : 'dexp)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'expression) in Obj.repr( # 47 "parser.mly" ( _1 ) # 229 "parser.ml" : 'dexp)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'simpexp) in Obj.repr( # 51 "parser.mly" ( _1 ) # 236 "parser.ml" : 'expression)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'application) in Obj.repr( # 53 "parser.mly" ( _1 ) # 243 "parser.ml" : 'expression)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in Obj.repr( # 57 "parser.mly" ( Lambda.Var(_1,0) ) # 250 "parser.ml" : 'simpexp)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 0 : int) in Obj.repr( # 59 "parser.mly" ( Lambda.Var("",_2) ) # 257 "parser.ml" : 'simpexp)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : int) in Obj.repr( # 61 "parser.mly" ( Lambda.Num(_1) ) # 264 "parser.ml" : 'simpexp)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 1 : 'dexp) in Obj.repr( # 64 "parser.mly" ( _2 ) # 271 "parser.ml" : 'simpexp)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'abstraction) in Obj.repr( # 66 "parser.mly" ( _1 ) # 278 "parser.ml" : 'simpexp)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 2 : string) in let _4 = (Parsing.peek_val __caml_parser_env 0 : 'dexp) in Obj.repr( # 72 "parser.mly" ( Lambda.Lambda(_2,_4) ) # 286 "parser.ml" : 'abstraction)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 0 : 'dexp) in Obj.repr( # 75 "parser.mly" ( Lambda.Lambda("",_2) ) # 293 "parser.ml" : 'abstraction)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 1 : 'application) in let _2 = (Parsing.peek_val __caml_parser_env 0 : 'simpexp) in Obj.repr( # 79 "parser.mly" ( Lambda.Apply(_1,_2) ) # 301 "parser.ml" : 'application)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 1 : 'simpexp) in let _2 = (Parsing.peek_val __caml_parser_env 0 : 'simpexp) in Obj.repr( # 81 "parser.mly" ( Lambda.Apply(_1,_2) ) # 309 "parser.ml" : 'application)) (* Entry program *) ; (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 program (lexfun : Lexing.lexbuf -> token) (lexbuf : Lexing.lexbuf) = (Parsing.yyparse yytables 1 lexfun lexbuf : Lambda.exp list) ;; # 85 "parser.mly" (* End of parser.mly *) # 338 "parser.ml"