diff options
| author | krasimir <krasimir@chalmers.se> | 2009-05-18 15:52:10 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2009-05-18 15:52:10 +0000 |
| commit | 5f986f599216d3c6aa86515ae1949612414ff9c6 (patch) | |
| tree | b05285a7e3d52b52695d5e1757e8b2eee7bc5bcc /src/GF/Compile | |
| parent | 7508fa578551672711fcec8c4b37d79c3a3de5ef (diff) | |
added filtering for useless productions in PMCFG
Diffstat (limited to 'src/GF/Compile')
| -rw-r--r-- | src/GF/Compile/GenerateFCFG.hs | 1 | ||||
| -rw-r--r-- | src/GF/Compile/GeneratePMCFG.hs | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/GF/Compile/GenerateFCFG.hs b/src/GF/Compile/GenerateFCFG.hs index 26fd2a4d9..bb8ba9452 100644 --- a/src/GF/Compile/GenerateFCFG.hs +++ b/src/GF/Compile/GenerateFCFG.hs @@ -329,6 +329,7 @@ getParserInfo :: GrammarEnv -> ParserInfo getParserInfo (GrammarEnv last_id catSet seqSet funSet prodSet) = ParserInfo { functions = mkArray funSet , sequences = mkArray seqSet + , productions0= prodSet , productions = prodSet , startCats = Map.map getFCatList catSet , totalCats = last_id+1 diff --git a/src/GF/Compile/GeneratePMCFG.hs b/src/GF/Compile/GeneratePMCFG.hs index e29fce754..bb3215102 100644 --- a/src/GF/Compile/GeneratePMCFG.hs +++ b/src/GF/Compile/GeneratePMCFG.hs @@ -405,13 +405,15 @@ getParserInfo :: GrammarEnv -> ParserInfo getParserInfo (GrammarEnv last_id catSet seqSet funSet crcSet prodSet) = ParserInfo { functions = mkArray funSet , sequences = mkArray seqSet - , productions = IntMap.union prodSet coercions + , productions0= productions0 + , productions = filterProductions productions0 , startCats = maybe Map.empty (Map.map (\(start,end,_) -> range (start,end))) (IntMap.lookup 0 catSet) , totalCats = last_id+1 } where mkArray map = array (0,Map.size map-1) [(v,k) | (k,v) <- Map.toList map] + productions0 = IntMap.union prodSet coercions coercions = IntMap.fromList [(fcat,Set.fromList (map FCoerce sub_fcats)) | (sub_fcats,fcat) <- Map.toList crcSet] getFCats :: GrammarEnv -> ProtoFCat -> [FCat] |
