bug fix in the new partial evaluator

It can leave wildcard tables in their origial form, but it easy to handle
them in the unfactor function in GeneratePMCFG.
This commit is contained in:
hallgren
2012-12-20 16:41:43 +00:00
parent 5ff33f47be
commit 12dec2503d

View File

@@ -148,10 +148,18 @@ unfactor t = CM (\gr c -> c (unfac gr t))
where where
unfac gr t = unfac gr t =
case t of case t of
T (TTyped ty) [(PV x,u)] -> V ty [restore x v (unfac gr u) | v <- err bug id (allParamValues gr ty)] T (TTyped ty) [(PV x,u)] -> let u' = unfac gr u
T (TTyped ty) _ -> ppbug $ text "unfactor"<+>ppTerm Unqualified 10 t in V ty [restore x v u' | v <- allparams ty]
T (TTyped ty) [(PW ,u)] -> let u' = unfac gr u
in V ty [u' | _ <- allparams ty]
T (TTyped ty) _ -> -- converTerm doesn't handle these tables
ppbug $
sep [text "unfactor"<+>ppTerm Unqualified 10 t,
text (show t)]
_ -> composSafeOp (unfac gr) t _ -> composSafeOp (unfac gr) t
where where
allparams ty = err bug id (allParamValues gr ty)
restore x u t = case t of restore x u t = case t of
Vr y | y == x -> u Vr y | y == x -> u
_ -> composSafeOp (restore x u) t _ -> composSafeOp (restore x u) t