130 | (SEQ(r1, r2), Right(v2)) => Sequ(mkeps r1, inj r2 c v2) |
130 | (SEQ(r1, r2), Right(v2)) => Sequ(mkeps r1, inj r2 c v2) |
131 | (ALT(r1, r2), Left(v1)) => Left(inj r1 c v1) |
131 | (ALT(r1, r2), Left(v1)) => Left(inj r1 c v1) |
132 | (ALT(r1, r2), Right(v2)) => Right(inj r2 c v2) |
132 | (ALT(r1, r2), Right(v2)) => Right(inj r2 c v2) |
133 | (CHAR(d), Empty) => Chr(d) |
133 | (CHAR(d), Empty) => Chr(d) |
134 | (RECD(x, r1), _) => Rec(x, inj r1 c v) |
134 | (RECD(x, r1), _) => Rec(x, inj r1 c v) |
135 | _ => (print ("\nr: " ^ PolyML.makestring r ^ "\n"); |
135 | _ => raise Error |
136 print ("v: " ^ PolyML.makestring v ^ "\n"); |
|
137 raise Error) |
|
138 |
136 |
139 (* some "rectification" functions for simplification *) |
137 (* some "rectification" functions for simplification *) |
140 fun f_id v = v |
138 fun f_id v = v |
141 fun f_right f = fn v => Right(f v) |
139 fun f_right f = fn v => Right(f v) |
142 fun f_left f = fn v => Left(f v) |
140 fun f_left f = fn v => Left(f v) |
336 (print ((Real.toString t_end) ^ "\n"); f_x) |
334 (print ((Real.toString t_end) ^ "\n"); f_x) |
337 end |
335 end |
338 |
336 |
339 val prog = "ab"; |
337 val prog = "ab"; |
340 val reg = ("x" $ ((str "a") -- (str "b"))); |
338 val reg = ("x" $ ((str "a") -- (str "b"))); |
341 print("Simp: " ^ PolyML.makestring (lexing_simp reg prog) ^ "\n"); |
339 print("Simp: " ^ (lexing_simp reg prog) ^ "\n"); |
342 print("Acc: " ^ PolyML.makestring (lexing_acc reg prog) ^ "\n"); |
340 print("Acc: " ^ (lexing_acc reg prog) ^ "\n"); |
343 print("Env " ^ string_of_env (env (lexing_acc reg prog)) ^ "\n"); |
341 print("Env " ^ string_of_env (env (lexing_acc reg prog)) ^ "\n"); |
344 |
342 |
345 fun fst (x, y) = x; |
343 fun fst (x, y) = x; |
346 fun snd (x, y) = y; |
344 fun snd (x, y) = y; |
347 |
345 |