18 let yytransl_const = [|
32 let yytransl_block = [|
37 let yylhs = "\255\255\
38 \001\000\002\000\002\000\003\000\003\000\005\000\006\000\006\000\
39 \004\000\004\000\004\000\009\000\010\000\007\000\008\000\008\000\
40 \008\000\008\000\008\000\008\000\008\000\008\000\000\000"
42 let yylen = "\002\000\
43 \002\000\001\000\002\000\001\000\001\000\006\000\001\000\003\000\
44 \001\000\001\000\001\000\003\000\002\000\002\000\001\000\001\000\
45 \003\000\003\000\003\000\003\000\003\000\002\000\002\000"
47 let yydefred = "\000\000\
48 \000\000\000\000\015\000\000\000\000\000\000\000\023\000\000\000\
49 \002\000\000\000\005\000\000\000\009\000\010\000\011\000\000\000\
50 \000\000\000\000\000\000\001\000\003\000\000\000\000\000\000\000\
51 \000\000\000\000\000\000\000\000\000\000\013\000\017\000\000\000\
52 \000\000\000\000\000\000\000\000\007\000\000\000\012\000\000\000\
55 let yydgoto = "\002\000\
56 \007\000\008\000\009\000\026\000\011\000\018\000\013\000\014\000\
59 let yysindex = "\007\000\
60 \120\255\000\000\000\000\000\000\120\255\120\255\000\000\012\255\
61 \000\000\106\255\000\000\001\255\000\000\000\000\000\000\245\254\
62 \124\255\049\255\098\255\000\000\000\000\120\255\120\255\120\255\
63 \120\255\106\255\009\255\024\255\120\255\000\000\000\000\113\255\
64 \124\255\124\255\124\255\120\255\000\000\026\255\000\000\088\255\
67 let yyrindex = "\000\000\
68 \000\000\000\000\000\000\042\255\000\000\000\000\000\000\000\000\
69 \000\000\063\255\000\000\000\000\000\000\000\000\000\000\000\000\
70 \028\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
71 \000\000\074\255\050\255\000\000\000\000\000\000\000\000\007\255\
72 \053\255\064\255\075\255\000\000\000\000\052\255\000\000\000\000\
75 let yygindex = "\000\000\
76 \000\000\000\000\254\255\255\255\000\000\001\000\000\000\000\000\
80 let yytable = "\010\000\
81 \029\000\012\000\027\000\017\000\019\000\021\000\010\000\001\000\
82 \012\000\018\000\018\000\028\000\003\000\004\000\018\000\005\000\
83 \018\000\036\000\006\000\018\000\032\000\033\000\034\000\035\000\
84 \020\000\037\000\039\000\010\000\038\000\012\000\022\000\022\000\
85 \022\000\022\000\040\000\022\000\028\000\022\000\042\000\010\000\
86 \022\000\012\000\016\000\007\000\016\000\016\000\016\000\016\000\
87 \016\000\016\000\030\000\016\000\007\000\008\000\016\000\019\000\
88 \019\000\022\000\022\000\028\000\019\000\013\000\019\000\000\000\
89 \000\000\019\000\020\000\020\000\020\000\020\000\004\000\020\000\
90 \004\000\020\000\000\000\004\000\020\000\021\000\021\000\021\000\
91 \021\000\014\000\021\000\014\000\021\000\000\000\014\000\021\000\
92 \003\000\004\000\022\000\023\000\024\000\025\000\006\000\000\000\
93 \000\000\041\000\003\000\004\000\022\000\023\000\024\000\025\000\
94 \006\000\031\000\003\000\004\000\022\000\023\000\024\000\025\000\
95 \006\000\003\000\004\000\000\000\000\000\024\000\025\000\006\000\
96 \003\000\004\000\000\000\005\000\003\000\004\000\006\000\000\000\
97 \000\000\000\000\006\000"
99 let yycheck = "\001\000\
100 \012\001\001\000\002\001\005\000\006\000\008\000\008\000\001\000\
101 \008\000\003\001\004\001\011\001\001\001\002\001\008\001\004\001\
102 \010\001\009\001\007\001\013\001\022\000\023\000\024\000\025\000\
103 \013\001\002\001\029\000\029\000\028\000\029\000\003\001\004\001\
104 \005\001\006\001\036\000\008\001\011\001\010\001\041\000\041\000\
105 \013\001\041\000\001\001\002\001\003\001\004\001\005\001\006\001\
106 \007\001\008\001\002\001\010\001\011\001\002\001\013\001\003\001\
107 \004\001\005\001\006\001\011\001\008\001\012\001\010\001\255\255\
108 \255\255\013\001\003\001\004\001\005\001\006\001\008\001\008\001\
109 \010\001\010\001\255\255\013\001\013\001\003\001\004\001\005\001\
110 \006\001\008\001\008\001\010\001\010\001\255\255\013\001\013\001\
111 \001\001\002\001\003\001\004\001\005\001\006\001\007\001\255\255\
112 \255\255\010\001\001\001\002\001\003\001\004\001\005\001\006\001\
113 \007\001\008\001\001\001\002\001\003\001\004\001\005\001\006\001\
114 \007\001\001\001\002\001\255\255\255\255\005\001\006\001\007\001\
115 \001\001\002\001\255\255\004\001\001\001\002\001\007\001\255\255\
116 \255\255\255\255\007\001"
118 let yynames_const = "\
132 let yynames_block = "\
138 (fun _ -> failwith "parser")
139 ; (fun __caml_parser_env ->
140 let _1 = (Parsing.peek_val __caml_parser_env 1 : 'blocks) in
146 ; (fun __caml_parser_env ->
147 let _1 = (Parsing.peek_val __caml_parser_env 0 : 'block) in
153 ; (fun __caml_parser_env ->
154 let _1 = (Parsing.peek_val __caml_parser_env 1 : 'blocks) in
155 let _2 = (Parsing.peek_val __caml_parser_env 0 : 'block) in
158 (match _1 with Ast.Node x -> Ast.Node (x @ [_2])
159 | Ast.Int x -> Ast.Node[_1; _2] | Ast.Leaf x -> Ast.Node [_1; _2])
162 ; (fun __caml_parser_env ->
163 let _1 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
169 ; (fun __caml_parser_env ->
170 let _1 = (Parsing.peek_val __caml_parser_env 0 : 'let_bind) in
176 ; (fun __caml_parser_env ->
177 let _1 = (Parsing.peek_val __caml_parser_env 5 : 'typ) in
178 let _2 = (Parsing.peek_val __caml_parser_env 4 : string) in
179 let _4 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
180 let _6 = (Parsing.peek_val __caml_parser_env 0 : 'block) in
183 (Ast.Node [Ast.Leaf "%let"; Ast.Node[_1; Ast.Leaf _2; _4]; _6])
186 ; (fun __caml_parser_env ->
187 let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in
193 ; (fun __caml_parser_env ->
194 let _1 = (Parsing.peek_val __caml_parser_env 2 : 'typ) in
195 let _3 = (Parsing.peek_val __caml_parser_env 0 : 'typ) in
198 (Ast.Node [Ast.Leaf "->"; _1 ; _3])
201 ; (fun __caml_parser_env ->
202 let _1 = (Parsing.peek_val __caml_parser_env 0 : 'app_expr) in
208 ; (fun __caml_parser_env ->
209 let _1 = (Parsing.peek_val __caml_parser_env 0 : 'bin_expr) in
215 ; (fun __caml_parser_env ->
216 let _1 = (Parsing.peek_val __caml_parser_env 0 : 'lam_expr) in
222 ; (fun __caml_parser_env ->
223 let _1 = (Parsing.peek_val __caml_parser_env 2 : 'arg) in
224 let _3 = (Parsing.peek_val __caml_parser_env 0 : 'block) in
227 (Ast.Node [Ast.Leaf "%lambda"; _1 ; _3])
230 ; (fun __caml_parser_env ->
231 let _1 = (Parsing.peek_val __caml_parser_env 1 : 'typ) in
232 let _2 = (Parsing.peek_val __caml_parser_env 0 : string) in
235 ( Ast.Node [_1;Ast.Leaf _2] )
238 ; (fun __caml_parser_env ->
239 let _1 = (Parsing.peek_val __caml_parser_env 1 : 'expr) in
240 let _2 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
243 ( Ast.Node [ Ast.Leaf "%apply"; _1; _2] )
246 ; (fun __caml_parser_env ->
247 let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in
250 ( Ast.Int (int_of_string _1))
253 ; (fun __caml_parser_env ->
254 let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in
260 ; (fun __caml_parser_env ->
261 let _2 = (Parsing.peek_val __caml_parser_env 1 : 'expr) in
267 ; (fun __caml_parser_env ->
268 let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
269 let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
272 ( Ast.Node [ Ast.Leaf "+"; _1; _3] )
275 ; (fun __caml_parser_env ->
276 let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
277 let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
280 ( Ast.Node[ Ast.Leaf "-"; _1 ; _3] )
283 ; (fun __caml_parser_env ->
284 let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
285 let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
288 ( Ast.Node[ Ast.Leaf "*"; _1 ;_3] )
291 ; (fun __caml_parser_env ->
292 let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
293 let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
296 ( Ast.Node[ Ast.Leaf "/"; _1; _3] )
299 ; (fun __caml_parser_env ->
300 let _2 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
303 ( Ast.Node[ Ast.Leaf "-" ; _2] )
307 ; (fun __caml_parser_env -> raise (Parsing.YYexit (Parsing.peek_val __caml_parser_env 0)))
310 { Parsing.actions=yyact;
311 Parsing.transl_const=yytransl_const;
312 Parsing.transl_block=yytransl_block;
315 Parsing.defred=yydefred;
316 Parsing.dgoto=yydgoto;
317 Parsing.sindex=yysindex;
318 Parsing.rindex=yyrindex;
319 Parsing.gindex=yygindex;
320 Parsing.tablesize=yytablesize;
321 Parsing.table=yytable;
322 Parsing.check=yycheck;
323 Parsing.error_function=parse_error;
324 Parsing.names_const=yynames_const;
325 Parsing.names_block=yynames_block }
326 let main (lexfun : Lexing.lexbuf -> token) (lexbuf : Lexing.lexbuf) =
327 (Parsing.yyparse yytables 1 lexfun lexbuf : Ast.ast)