summaryrefslogtreecommitdiff
path: root/src-3.0/PGF/Parsing/FCFG.hs
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2008-05-30 07:23:00 +0000
committerkrasimir <krasimir@chalmers.se>2008-05-30 07:23:00 +0000
commit1077fa1f30c0714933d02cf4b9c20cbe30fd9876 (patch)
tree488be80c793531d3983c1effe23a4b053280fefc /src-3.0/PGF/Parsing/FCFG.hs
parent88d3f61f41f7b6299e0d0f9e0047dd955cb67571 (diff)
don't need SyntaxTree anymore. Use PGF.Data.Exp directly
Diffstat (limited to 'src-3.0/PGF/Parsing/FCFG.hs')
-rw-r--r--src-3.0/PGF/Parsing/FCFG.hs29
1 files changed, 1 insertions, 28 deletions
diff --git a/src-3.0/PGF/Parsing/FCFG.hs b/src-3.0/PGF/Parsing/FCFG.hs
index 64421a0c4..81fc6a3e4 100644
--- a/src-3.0/PGF/Parsing/FCFG.hs
+++ b/src-3.0/PGF/Parsing/FCFG.hs
@@ -43,36 +43,9 @@ parseFCF strategy pinfo startCat inString =
finalEdges = [makeFinalEdge cat i j | cat <- startCats]
forests = chart2forests chart (const False) finalEdges
filteredForests = forests >>= applyProfileToForest
- trees = nubsort $ filteredForests >>= forest2trees
- return $ map tree2term trees
+ return $ nubsort $ filteredForests >>= forest2exps
where
parseFCF :: String -> Err (FCFParser)
parseFCF "bottomup" = Ok $ parse "b"
parseFCF "topdown" = Ok $ parse "t"
parseFCF strat = Bad $ "FCFG parsing strategy not defined: " ++ strat
-
-----------------------------------------------------------------------
--- parse trees to GFCC terms
-
-tree2term :: SyntaxTree CId -> Exp
-tree2term (TNode f ts) = tree (AC f) (map tree2term ts)
-tree2term (TString s) = tree (AS s) []
-tree2term (TInt n) = tree (AI n) []
-tree2term (TFloat f) = tree (AF f) []
-tree2term (TMeta) = exp0
-
-----------------------------------------------------------------------
--- conversion and unification of forests
-
--- simplest implementation
-applyProfileToForest :: SyntaxForest (CId,[Profile]) -> [SyntaxForest CId]
-applyProfileToForest (FNode (fun,profiles) children)
- | fun == wildCId = concat chForests
- | otherwise = [ FNode fun chForests | not (null chForests) ]
- where chForests = concat [ mapM (unifyManyForests . map (forests !!)) profiles |
- forests0 <- children,
- forests <- mapM applyProfileToForest forests0 ]
-applyProfileToForest (FString s) = [FString s]
-applyProfileToForest (FInt n) = [FInt n]
-applyProfileToForest (FFloat f) = [FFloat f]
-applyProfileToForest (FMeta) = [FMeta]