~ubuntu-branches/ubuntu/precise/kalzium/precise

« back to all changes in this revision

Viewing changes to src/solver/parser.ml

  • Committer: Bazaar Package Importer
  • Author(s): Philip Muškovac
  • Date: 2011-07-03 12:28:58 UTC
  • Revision ID: james.westby@ubuntu.com-20110703122858-q1yyxncs89e4w0hs
Tags: upstream-4.6.90+repack
Import upstream version 4.6.90+repack

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
type token =
 
2
  | INT of (int)
 
3
  | PLUS
 
4
  | MINUS
 
5
  | LPAREN
 
6
  | RPAREN
 
7
  | LBRACKET
 
8
  | RBRACKET
 
9
  | EOF
 
10
  | CAPITAL of (string)
 
11
  | MINOR of (string)
 
12
  | ARROW
 
13
 
 
14
open Parsing;;
 
15
# 26 "parser.mly"
 
16
        open Chemset
 
17
        
 
18
        (*let parse_error somestring = Printf.printf "%s \n" somestring;;
 
19
        *)
 
20
# 21 "parser.ml"
 
21
let yytransl_const = [|
 
22
  258 (* PLUS *);
 
23
  259 (* MINUS *);
 
24
  260 (* LPAREN *);
 
25
  261 (* RPAREN *);
 
26
  262 (* LBRACKET *);
 
27
  263 (* RBRACKET *);
 
28
    0 (* EOF *);
 
29
  266 (* ARROW *);
 
30
    0|]
 
31
 
 
32
let yytransl_block = [|
 
33
  257 (* INT *);
 
34
  264 (* CAPITAL *);
 
35
  265 (* MINOR *);
 
36
    0|]
 
37
 
 
38
let yylhs = "\255\255\
 
39
\001\000\002\000\003\000\003\000\004\000\004\000\004\000\005\000\
 
40
\005\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\
 
41
\007\000\007\000\000\000"
 
42
 
 
43
let yylen = "\002\000\
 
44
\002\000\003\000\001\000\003\000\002\000\002\000\001\000\001\000\
 
45
\002\000\002\000\001\000\004\000\004\000\004\000\003\000\003\000\
 
46
\002\000\001\000\002\000"
 
47
 
 
48
let yydefred = "\000\000\
 
49
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\019\000\
 
50
\000\000\000\000\000\000\007\000\000\000\000\000\006\000\000\000\
 
51
\000\000\000\000\000\000\017\000\005\000\001\000\000\000\000\000\
 
52
\009\000\010\000\000\000\000\000\000\000\015\000\016\000\002\000\
 
53
\004\000\012\000\013\000\014\000"
 
54
 
 
55
let yydgoto = "\002\000\
 
56
\008\000\009\000\010\000\011\000\012\000\013\000\014\000"
 
57
 
 
58
let yysindex = "\003\000\
 
59
\010\255\000\000\016\255\016\255\024\255\247\254\016\255\000\000\
 
60
\007\000\003\255\015\255\000\000\016\255\020\255\000\000\018\255\
 
61
\007\255\021\255\025\255\000\000\000\000\000\000\010\255\010\255\
 
62
\000\000\000\000\030\255\026\255\027\255\000\000\000\000\000\000\
 
63
\000\000\000\000\000\000\000\000"
 
64
 
 
65
let yyrindex = "\000\000\
 
66
\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\
 
67
\000\000\000\000\005\000\000\000\015\000\008\000\000\000\000\000\
 
68
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
69
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
70
\000\000\000\000\000\000\000\000"
 
71
 
 
72
let yygindex = "\000\000\
 
73
\000\000\000\000\006\000\000\000\255\255\000\000\000\000"
 
74
 
 
75
let yytablesize = 281
 
76
let yytable = "\020\000\
 
77
\018\000\015\000\016\000\001\000\003\000\021\000\022\000\011\000\
 
78
\028\000\029\000\003\000\025\000\023\000\004\000\008\000\005\000\
 
79
\024\000\006\000\007\000\004\000\026\000\005\000\027\000\006\000\
 
80
\017\000\018\000\019\000\030\000\032\000\033\000\034\000\031\000\
 
81
\035\000\036\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
82
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
83
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
84
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
85
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
86
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
87
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
88
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
89
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
90
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
91
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
92
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
93
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
94
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
95
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
96
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
97
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
98
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
99
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
100
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
101
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
102
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
103
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
104
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
105
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
106
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
107
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
108
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
 
109
\000\000\018\000\018\000\000\000\018\000\018\000\018\000\000\000\
 
110
\018\000\011\000\018\000\011\000\011\000\011\000\003\000\011\000\
 
111
\008\000\011\000\000\000\008\000\000\000\000\000\000\000\000\000\
 
112
\008\000"
 
113
 
 
114
let yycheck = "\009\001\
 
115
\000\000\003\000\004\000\001\000\000\000\007\000\000\000\000\000\
 
116
\002\001\003\001\001\001\013\000\010\001\004\001\000\000\006\001\
 
117
\002\001\008\001\009\001\004\001\001\001\006\001\005\001\008\001\
 
118
\001\001\002\001\003\001\007\001\023\000\024\000\001\001\007\001\
 
119
\007\001\007\001\255\255\255\255\255\255\255\255\255\255\255\255\
 
120
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
121
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
122
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
123
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
124
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
125
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
126
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
127
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
128
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
129
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
130
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
131
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
132
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
133
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
134
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
135
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
136
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
137
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
138
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
139
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
140
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
141
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
142
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
143
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
144
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
145
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
146
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
 
147
\255\255\001\001\002\001\255\255\004\001\005\001\006\001\255\255\
 
148
\008\001\002\001\010\001\004\001\005\001\006\001\010\001\008\001\
 
149
\002\001\010\001\255\255\005\001\255\255\255\255\255\255\255\255\
 
150
\010\001"
 
151
 
 
152
let yynames_const = "\
 
153
  PLUS\000\
 
154
  MINUS\000\
 
155
  LPAREN\000\
 
156
  RPAREN\000\
 
157
  LBRACKET\000\
 
158
  RBRACKET\000\
 
159
  EOF\000\
 
160
  ARROW\000\
 
161
  "
 
162
 
 
163
let yynames_block = "\
 
164
  INT\000\
 
165
  CAPITAL\000\
 
166
  MINOR\000\
 
167
  "
 
168
 
 
169
let yyact = [|
 
170
  (fun _ -> failwith "parser")
 
171
; (fun __caml_parser_env ->
 
172
    let _1 = (Parsing.peek_val __caml_parser_env 1 : 'equation) in
 
173
    Obj.repr(
 
174
# 44 "parser.mly"
 
175
                 ( _1 )
 
176
# 177 "parser.ml"
 
177
               : Chemset.listitems))
 
178
; (fun __caml_parser_env ->
 
179
    let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in
 
180
    let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
 
181
    Obj.repr(
 
182
# 49 "parser.mly"
 
183
                    ( chem_negate _3; List.append _1 _3 )
 
184
# 185 "parser.ml"
 
185
               : 'equation))
 
186
; (fun __caml_parser_env ->
 
187
    let _1 = (Parsing.peek_val __caml_parser_env 0 : 'item) in
 
188
    Obj.repr(
 
189
# 53 "parser.mly"
 
190
         ( _1::[] )
 
191
# 192 "parser.ml"
 
192
               : 'expr))
 
193
; (fun __caml_parser_env ->
 
194
    let _1 = (Parsing.peek_val __caml_parser_env 2 : 'item) in
 
195
    let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
 
196
    Obj.repr(
 
197
# 54 "parser.mly"
 
198
                     ( _1::_3 )
 
199
# 200 "parser.ml"
 
200
               : 'expr))
 
201
; (fun __caml_parser_env ->
 
202
    let _1 = (Parsing.peek_val __caml_parser_env 1 : string) in
 
203
    let _2 = (Parsing.peek_val __caml_parser_env 0 : 'symbols) in
 
204
    Obj.repr(
 
205
# 58 "parser.mly"
 
206
                  ( {ikey=_1; itbl=_2; sign=1} )
 
207
# 208 "parser.ml"
 
208
               : 'item))
 
209
; (fun __caml_parser_env ->
 
210
    let _1 = (Parsing.peek_val __caml_parser_env 1 : int) in
 
211
    let _2 = (Parsing.peek_val __caml_parser_env 0 : 'symbols) in
 
212
    Obj.repr(
 
213
# 59 "parser.mly"
 
214
                  ( {ikey=string_of_int(_1); itbl=_2; sign=1} )
 
215
# 216 "parser.ml"
 
216
               : 'item))
 
217
; (fun __caml_parser_env ->
 
218
    let _1 = (Parsing.peek_val __caml_parser_env 0 : 'symbols) in
 
219
    Obj.repr(
 
220
# 60 "parser.mly"
 
221
              ( {ikey="1"; itbl=_1; sign=1})
 
222
# 223 "parser.ml"
 
223
               : 'item))
 
224
; (fun __caml_parser_env ->
 
225
    let _1 = (Parsing.peek_val __caml_parser_env 0 : 'qte) in
 
226
    Obj.repr(
 
227
# 64 "parser.mly"
 
228
        ( _1 )
 
229
# 230 "parser.ml"
 
230
               : 'symbols))
 
231
; (fun __caml_parser_env ->
 
232
    let _1 = (Parsing.peek_val __caml_parser_env 1 : 'qte) in
 
233
    let _2 = (Parsing.peek_val __caml_parser_env 0 : 'symbols) in
 
234
    Obj.repr(
 
235
# 65 "parser.mly"
 
236
                  ( chem_add _1 _2 )
 
237
# 238 "parser.ml"
 
238
               : 'symbols))
 
239
; (fun __caml_parser_env ->
 
240
    let _1 = (Parsing.peek_val __caml_parser_env 1 : 'element) in
 
241
    let _2 = (Parsing.peek_val __caml_parser_env 0 : int) in
 
242
    Obj.repr(
 
243
# 69 "parser.mly"
 
244
                ( createchem _1 _2 )
 
245
# 246 "parser.ml"
 
246
               : 'qte))
 
247
; (fun __caml_parser_env ->
 
248
    let _1 = (Parsing.peek_val __caml_parser_env 0 : 'element) in
 
249
    Obj.repr(
 
250
# 70 "parser.mly"
 
251
              ( createchem _1 1 )
 
252
# 253 "parser.ml"
 
253
               : 'qte))
 
254
; (fun __caml_parser_env ->
 
255
    let _2 = (Parsing.peek_val __caml_parser_env 2 : 'symbols) in
 
256
    let _4 = (Parsing.peek_val __caml_parser_env 0 : int) in
 
257
    Obj.repr(
 
258
# 71 "parser.mly"
 
259
                                ( chem_mult _2 _4 )
 
260
# 261 "parser.ml"
 
261
               : 'qte))
 
262
; (fun __caml_parser_env ->
 
263
    let _2 = (Parsing.peek_val __caml_parser_env 2 : int) in
 
264
    Obj.repr(
 
265
# 72 "parser.mly"
 
266
                                   ( createchem "+" _2 )
 
267
# 268 "parser.ml"
 
268
               : 'qte))
 
269
; (fun __caml_parser_env ->
 
270
    let _2 = (Parsing.peek_val __caml_parser_env 2 : int) in
 
271
    Obj.repr(
 
272
# 73 "parser.mly"
 
273
                                   ( createchem "-" _2 )
 
274
# 275 "parser.ml"
 
275
               : 'qte))
 
276
; (fun __caml_parser_env ->
 
277
    Obj.repr(
 
278
# 74 "parser.mly"
 
279
                               ( createchem "+" 1 )
 
280
# 281 "parser.ml"
 
281
               : 'qte))
 
282
; (fun __caml_parser_env ->
 
283
    Obj.repr(
 
284
# 75 "parser.mly"
 
285
                               ( createchem "-" 1 )
 
286
# 287 "parser.ml"
 
287
               : 'qte))
 
288
; (fun __caml_parser_env ->
 
289
    let _1 = (Parsing.peek_val __caml_parser_env 1 : string) in
 
290
    let _2 = (Parsing.peek_val __caml_parser_env 0 : string) in
 
291
    Obj.repr(
 
292
# 79 "parser.mly"
 
293
                  ( _1 ^ _2 )
 
294
# 295 "parser.ml"
 
295
               : 'element))
 
296
; (fun __caml_parser_env ->
 
297
    let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in
 
298
    Obj.repr(
 
299
# 80 "parser.mly"
 
300
              ( _1 )
 
301
# 302 "parser.ml"
 
302
               : 'element))
 
303
(* Entry main *)
 
304
; (fun __caml_parser_env -> raise (Parsing.YYexit (Parsing.peek_val __caml_parser_env 0)))
 
305
|]
 
306
let yytables =
 
307
  { Parsing.actions=yyact;
 
308
    Parsing.transl_const=yytransl_const;
 
309
    Parsing.transl_block=yytransl_block;
 
310
    Parsing.lhs=yylhs;
 
311
    Parsing.len=yylen;
 
312
    Parsing.defred=yydefred;
 
313
    Parsing.dgoto=yydgoto;
 
314
    Parsing.sindex=yysindex;
 
315
    Parsing.rindex=yyrindex;
 
316
    Parsing.gindex=yygindex;
 
317
    Parsing.tablesize=yytablesize;
 
318
    Parsing.table=yytable;
 
319
    Parsing.check=yycheck;
 
320
    Parsing.error_function=parse_error;
 
321
    Parsing.names_const=yynames_const;
 
322
    Parsing.names_block=yynames_block }
 
323
let main (lexfun : Lexing.lexbuf -> token) (lexbuf : Lexing.lexbuf) =
 
324
   (Parsing.yyparse yytables 1 lexfun lexbuf : Chemset.listitems)