diff options
Diffstat (limited to 'src/GF/Conversion')
| -rw-r--r-- | src/GF/Conversion/GFCtoSimple.hs | 4 | ||||
| -rw-r--r-- | src/GF/Conversion/SimpleToMCFG/Nondet.hs | 16 | ||||
| -rw-r--r-- | src/GF/Conversion/SimpleToMCFG/Strict.hs | 2 |
3 files changed, 10 insertions, 12 deletions
diff --git a/src/GF/Conversion/GFCtoSimple.hs b/src/GF/Conversion/GFCtoSimple.hs index a01deb08a..b6a34a8ce 100644 --- a/src/GF/Conversion/GFCtoSimple.hs +++ b/src/GF/Conversion/GFCtoSimple.hs @@ -119,8 +119,8 @@ expandTerm gram term = -- tracePrt "expanded term" prt $ convertCType :: Env -> A.CType -> SLinType convertCType gram (A.RecType rec) = RecT [ (lbl, convertCType gram ctype) | A.Lbg lbl ctype <- rec ] -convertCType gram (A.Table pt vt) = TblT (convertCType gram pt) (convertCType gram vt) -convertCType gram ct@(A.Cn con) = ConT con $ map (convertTerm gram) $ groundTerms gram ct +convertCType gram (A.Table pt vt) = TblT (enumerateTerms Nothing (convertCType gram pt)) (convertCType gram vt) +convertCType gram ct@(A.Cn con) = ConT $ map (convertTerm gram) $ groundTerms gram ct convertCType gram (A.TStr) = StrT convertCType gram (A.TInts n) = error "GFCtoSimple.convertCType: cannot handle 'TInts' constructor" diff --git a/src/GF/Conversion/SimpleToMCFG/Nondet.hs b/src/GF/Conversion/SimpleToMCFG/Nondet.hs index 514f2b382..d6ff052f5 100644 --- a/src/GF/Conversion/SimpleToMCFG/Nondet.hs +++ b/src/GF/Conversion/SimpleToMCFG/Nondet.hs @@ -136,15 +136,13 @@ simplifyCase (pat, term) = liftM2 (,) (simplifyTerm pat) (simplifyTerm term) reduceTerm :: SLinType -> SPath -> STerm -> CnvMonad () --reduceTerm ctype path (Variants terms) -- = member terms >>= reduceTerm ctype path -reduceTerm (StrT) path term = updateLin (path, term) -reduceTerm (ConT _ _) path term = do pat <- expandTerm term - updateHead (path, pat) +reduceTerm (StrT) path term = updateLin (path, term) +reduceTerm (ConT _) path term = do pat <- expandTerm term + updateHead (path, pat) reduceTerm (RecT rtype) path term - = sequence_ [ reduceTerm ctype (path ++. lbl) (term +. lbl) | - (lbl, ctype) <- rtype ] -reduceTerm (TblT ptype vtype) path table - = sequence_ [ reduceTerm vtype (path ++! pat) (table +! pat) | - pat <- enumeratePatterns ptype ] + = sequence_ [ reduceTerm ctype (path ++. lbl) (term +. lbl) | (lbl, ctype) <- rtype ] +reduceTerm (TblT pats vtype) path table + = sequence_ [ reduceTerm vtype (path ++! pat) (table +! pat) | pat <- pats ] ------------------------------------------------------------ @@ -174,7 +172,7 @@ unifyPType arg (RecT prec) = sequence [ liftM ((,) lbl) $ unifyPType (arg +. lbl) ptype | (lbl, ptype) <- prec ] -unifyPType (Arg nr _ path) (ConT con terms) = +unifyPType (Arg nr _ path) (ConT terms) = do (_, args, _, _) <- readState case lookup path (ecatConstraints (args !! nr)) of Just term -> return term diff --git a/src/GF/Conversion/SimpleToMCFG/Strict.hs b/src/GF/Conversion/SimpleToMCFG/Strict.hs index 6ca7c4737..a5519fcd8 100644 --- a/src/GF/Conversion/SimpleToMCFG/Strict.hs +++ b/src/GF/Conversion/SimpleToMCFG/Strict.hs @@ -109,7 +109,7 @@ termPaths ctype term | isBaseType ctype = [ (emptyPath, (ctype, term)) ] parPaths :: SLinType -> STerm -> [[(SPath, STerm)]] parPaths ctype term = mapM (uncurry (map . (,))) $ groupPairs $ nubsort [ (path, value) | - (path, (ConT _ _, value)) <- termPaths ctype term ] + (path, (ConT _, value)) <- termPaths ctype term ] strPaths :: SLinType -> STerm -> [(SPath, STerm)] strPaths ctype term = [ (path, variants values) | (path, values) <- groupPairs paths ] |
