Warning, /education/kalzium/src/solver/parser.ml is written in an unsupported language. File is not indexed.
0001 type token = 0002 | INT of (int) 0003 | PLUS 0004 | MINUS 0005 | LPAREN 0006 | RPAREN 0007 | LBRACKET 0008 | RBRACKET 0009 | EOF 0010 | CAPITAL of (string) 0011 | MINOR of (string) 0012 | ARROW 0013 0014 open Parsing;; 0015 # 26 "parser.mly" 0016 open Chemset 0017 0018 (*let parse_error somestring = Printf.printf "%s \n" somestring;; 0019 *) 0020 # 21 "parser.ml" 0021 let yytransl_const = [| 0022 258 (* PLUS *); 0023 259 (* MINUS *); 0024 260 (* LPAREN *); 0025 261 (* RPAREN *); 0026 262 (* LBRACKET *); 0027 263 (* RBRACKET *); 0028 0 (* EOF *); 0029 266 (* ARROW *); 0030 0|] 0031 0032 let yytransl_block = [| 0033 257 (* INT *); 0034 264 (* CAPITAL *); 0035 265 (* MINOR *); 0036 0|] 0037 0038 let yylhs = "\255\255\ 0039 \001\000\002\000\003\000\003\000\004\000\004\000\004\000\005\000\ 0040 \005\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ 0041 \007\000\007\000\000\000" 0042 0043 let yylen = "\002\000\ 0044 \002\000\003\000\001\000\003\000\002\000\002\000\001\000\001\000\ 0045 \002\000\002\000\001\000\004\000\004\000\004\000\003\000\003\000\ 0046 \002\000\001\000\002\000" 0047 0048 let yydefred = "\000\000\ 0049 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\019\000\ 0050 \000\000\000\000\000\000\007\000\000\000\000\000\006\000\000\000\ 0051 \000\000\000\000\000\000\017\000\005\000\001\000\000\000\000\000\ 0052 \009\000\010\000\000\000\000\000\000\000\015\000\016\000\002\000\ 0053 \004\000\012\000\013\000\014\000" 0054 0055 let yydgoto = "\002\000\ 0056 \008\000\009\000\010\000\011\000\012\000\013\000\014\000" 0057 0058 let yysindex = "\003\000\ 0059 \010\255\000\000\016\255\016\255\024\255\247\254\016\255\000\000\ 0060 \007\000\003\255\015\255\000\000\016\255\020\255\000\000\018\255\ 0061 \007\255\021\255\025\255\000\000\000\000\000\000\010\255\010\255\ 0062 \000\000\000\000\030\255\026\255\027\255\000\000\000\000\000\000\ 0063 \000\000\000\000\000\000\000\000" 0064 0065 let yyrindex = "\000\000\ 0066 \000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\ 0067 \000\000\000\000\005\000\000\000\015\000\008\000\000\000\000\000\ 0068 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0069 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0070 \000\000\000\000\000\000\000\000" 0071 0072 let yygindex = "\000\000\ 0073 \000\000\000\000\006\000\000\000\255\255\000\000\000\000" 0074 0075 let yytablesize = 281 0076 let yytable = "\020\000\ 0077 \018\000\015\000\016\000\001\000\003\000\021\000\022\000\011\000\ 0078 \028\000\029\000\003\000\025\000\023\000\004\000\008\000\005\000\ 0079 \024\000\006\000\007\000\004\000\026\000\005\000\027\000\006\000\ 0080 \017\000\018\000\019\000\030\000\032\000\033\000\034\000\031\000\ 0081 \035\000\036\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0082 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0083 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0084 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0085 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0086 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0087 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0088 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0089 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0090 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0091 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0092 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0093 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0094 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0095 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0096 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0097 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0098 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0099 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0100 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0101 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0102 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0103 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0104 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0105 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0106 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0107 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0108 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ 0109 \000\000\018\000\018\000\000\000\018\000\018\000\018\000\000\000\ 0110 \018\000\011\000\018\000\011\000\011\000\011\000\003\000\011\000\ 0111 \008\000\011\000\000\000\008\000\000\000\000\000\000\000\000\000\ 0112 \008\000" 0113 0114 let yycheck = "\009\001\ 0115 \000\000\003\000\004\000\001\000\000\000\007\000\000\000\000\000\ 0116 \002\001\003\001\001\001\013\000\010\001\004\001\000\000\006\001\ 0117 \002\001\008\001\009\001\004\001\001\001\006\001\005\001\008\001\ 0118 \001\001\002\001\003\001\007\001\023\000\024\000\001\001\007\001\ 0119 \007\001\007\001\255\255\255\255\255\255\255\255\255\255\255\255\ 0120 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0121 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0122 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0123 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0124 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0125 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0126 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0127 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0128 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0129 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0130 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0131 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0132 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0133 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0134 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0135 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0136 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0137 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0138 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0139 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0140 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0141 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0142 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0143 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0144 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0145 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0146 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ 0147 \255\255\001\001\002\001\255\255\004\001\005\001\006\001\255\255\ 0148 \008\001\002\001\010\001\004\001\005\001\006\001\010\001\008\001\ 0149 \002\001\010\001\255\255\005\001\255\255\255\255\255\255\255\255\ 0150 \010\001" 0151 0152 let yynames_const = "\ 0153 PLUS\000\ 0154 MINUS\000\ 0155 LPAREN\000\ 0156 RPAREN\000\ 0157 LBRACKET\000\ 0158 RBRACKET\000\ 0159 EOF\000\ 0160 ARROW\000\ 0161 " 0162 0163 let yynames_block = "\ 0164 INT\000\ 0165 CAPITAL\000\ 0166 MINOR\000\ 0167 " 0168 0169 let yyact = [| 0170 (fun _ -> failwith "parser") 0171 ; (fun __caml_parser_env -> 0172 let _1 = (Parsing.peek_val __caml_parser_env 1 : 'equation) in 0173 Obj.repr( 0174 # 44 "parser.mly" 0175 ( _1 ) 0176 # 177 "parser.ml" 0177 : Chemset.listitems)) 0178 ; (fun __caml_parser_env -> 0179 let _1 = (Parsing.peek_val __caml_parser_env 2 : 'expr) in 0180 let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in 0181 Obj.repr( 0182 # 49 "parser.mly" 0183 ( chem_negate _3; List.append _1 _3 ) 0184 # 185 "parser.ml" 0185 : 'equation)) 0186 ; (fun __caml_parser_env -> 0187 let _1 = (Parsing.peek_val __caml_parser_env 0 : 'item) in 0188 Obj.repr( 0189 # 53 "parser.mly" 0190 ( _1::[] ) 0191 # 192 "parser.ml" 0192 : 'expr)) 0193 ; (fun __caml_parser_env -> 0194 let _1 = (Parsing.peek_val __caml_parser_env 2 : 'item) in 0195 let _3 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in 0196 Obj.repr( 0197 # 54 "parser.mly" 0198 ( _1::_3 ) 0199 # 200 "parser.ml" 0200 : 'expr)) 0201 ; (fun __caml_parser_env -> 0202 let _1 = (Parsing.peek_val __caml_parser_env 1 : string) in 0203 let _2 = (Parsing.peek_val __caml_parser_env 0 : 'symbols) in 0204 Obj.repr( 0205 # 58 "parser.mly" 0206 ( {ikey=_1; itbl=_2; sign=1} ) 0207 # 208 "parser.ml" 0208 : 'item)) 0209 ; (fun __caml_parser_env -> 0210 let _1 = (Parsing.peek_val __caml_parser_env 1 : int) in 0211 let _2 = (Parsing.peek_val __caml_parser_env 0 : 'symbols) in 0212 Obj.repr( 0213 # 59 "parser.mly" 0214 ( {ikey=string_of_int(_1); itbl=_2; sign=1} ) 0215 # 216 "parser.ml" 0216 : 'item)) 0217 ; (fun __caml_parser_env -> 0218 let _1 = (Parsing.peek_val __caml_parser_env 0 : 'symbols) in 0219 Obj.repr( 0220 # 60 "parser.mly" 0221 ( {ikey="1"; itbl=_1; sign=1}) 0222 # 223 "parser.ml" 0223 : 'item)) 0224 ; (fun __caml_parser_env -> 0225 let _1 = (Parsing.peek_val __caml_parser_env 0 : 'qte) in 0226 Obj.repr( 0227 # 64 "parser.mly" 0228 ( _1 ) 0229 # 230 "parser.ml" 0230 : 'symbols)) 0231 ; (fun __caml_parser_env -> 0232 let _1 = (Parsing.peek_val __caml_parser_env 1 : 'qte) in 0233 let _2 = (Parsing.peek_val __caml_parser_env 0 : 'symbols) in 0234 Obj.repr( 0235 # 65 "parser.mly" 0236 ( chem_add _1 _2 ) 0237 # 238 "parser.ml" 0238 : 'symbols)) 0239 ; (fun __caml_parser_env -> 0240 let _1 = (Parsing.peek_val __caml_parser_env 1 : 'element) in 0241 let _2 = (Parsing.peek_val __caml_parser_env 0 : int) in 0242 Obj.repr( 0243 # 69 "parser.mly" 0244 ( createchem _1 _2 ) 0245 # 246 "parser.ml" 0246 : 'qte)) 0247 ; (fun __caml_parser_env -> 0248 let _1 = (Parsing.peek_val __caml_parser_env 0 : 'element) in 0249 Obj.repr( 0250 # 70 "parser.mly" 0251 ( createchem _1 1 ) 0252 # 253 "parser.ml" 0253 : 'qte)) 0254 ; (fun __caml_parser_env -> 0255 let _2 = (Parsing.peek_val __caml_parser_env 2 : 'symbols) in 0256 let _4 = (Parsing.peek_val __caml_parser_env 0 : int) in 0257 Obj.repr( 0258 # 71 "parser.mly" 0259 ( chem_mult _2 _4 ) 0260 # 261 "parser.ml" 0261 : 'qte)) 0262 ; (fun __caml_parser_env -> 0263 let _2 = (Parsing.peek_val __caml_parser_env 2 : int) in 0264 Obj.repr( 0265 # 72 "parser.mly" 0266 ( createchem "+" _2 ) 0267 # 268 "parser.ml" 0268 : 'qte)) 0269 ; (fun __caml_parser_env -> 0270 let _2 = (Parsing.peek_val __caml_parser_env 2 : int) in 0271 Obj.repr( 0272 # 73 "parser.mly" 0273 ( createchem "-" _2 ) 0274 # 275 "parser.ml" 0275 : 'qte)) 0276 ; (fun __caml_parser_env -> 0277 Obj.repr( 0278 # 74 "parser.mly" 0279 ( createchem "+" 1 ) 0280 # 281 "parser.ml" 0281 : 'qte)) 0282 ; (fun __caml_parser_env -> 0283 Obj.repr( 0284 # 75 "parser.mly" 0285 ( createchem "-" 1 ) 0286 # 287 "parser.ml" 0287 : 'qte)) 0288 ; (fun __caml_parser_env -> 0289 let _1 = (Parsing.peek_val __caml_parser_env 1 : string) in 0290 let _2 = (Parsing.peek_val __caml_parser_env 0 : string) in 0291 Obj.repr( 0292 # 79 "parser.mly" 0293 ( _1 ^ _2 ) 0294 # 295 "parser.ml" 0295 : 'element)) 0296 ; (fun __caml_parser_env -> 0297 let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in 0298 Obj.repr( 0299 # 80 "parser.mly" 0300 ( _1 ) 0301 # 302 "parser.ml" 0302 : 'element)) 0303 (* Entry main *) 0304 ; (fun __caml_parser_env -> raise (Parsing.YYexit (Parsing.peek_val __caml_parser_env 0))) 0305 |] 0306 let yytables = 0307 { Parsing.actions=yyact; 0308 Parsing.transl_const=yytransl_const; 0309 Parsing.transl_block=yytransl_block; 0310 Parsing.lhs=yylhs; 0311 Parsing.len=yylen; 0312 Parsing.defred=yydefred; 0313 Parsing.dgoto=yydgoto; 0314 Parsing.sindex=yysindex; 0315 Parsing.rindex=yyrindex; 0316 Parsing.gindex=yygindex; 0317 Parsing.tablesize=yytablesize; 0318 Parsing.table=yytable; 0319 Parsing.check=yycheck; 0320 Parsing.error_function=parse_error; 0321 Parsing.names_const=yynames_const; 0322 Parsing.names_block=yynames_block } 0323 let main (lexfun : Lexing.lexbuf -> token) (lexbuf : Lexing.lexbuf) = 0324 (Parsing.yyparse yytables 1 lexfun lexbuf : Chemset.listitems)