diff options
| author | krasimir <krasimir@chalmers.se> | 2010-01-17 17:05:21 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2010-01-17 17:05:21 +0000 |
| commit | af13bae2dfb9adaa7c4aa273961fc09cc7ba1b7a (patch) | |
| tree | 74ba570e4d202dff02f330b50e11a0fa09b068a6 /src/runtime/haskell/PGF/PMCFG.hs | |
| parent | 9e3d4c74dc807cb26bb36303d2157c70c0668a8e (diff) | |
now the linearization is completely based on PMCFG
Diffstat (limited to 'src/runtime/haskell/PGF/PMCFG.hs')
| -rw-r--r-- | src/runtime/haskell/PGF/PMCFG.hs | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/src/runtime/haskell/PGF/PMCFG.hs b/src/runtime/haskell/PGF/PMCFG.hs index abf7e4380..0ef0e3295 100644 --- a/src/runtime/haskell/PGF/PMCFG.hs +++ b/src/runtime/haskell/PGF/PMCFG.hs @@ -34,12 +34,13 @@ data Alternative = deriving (Eq,Ord,Show)
data ParserInfo
- = ParserInfo { functions :: Array FunId FFun
- , sequences :: Array SeqId FSeq
- , productions0:: IntMap.IntMap (Set.Set Production) -- this are the original productions as they are loaded from the PGF file
- , productions :: IntMap.IntMap (Set.Set Production) -- this are the productions after the filtering for useless productions
- , startCats :: Map.Map CId (FCat,FCat,Array FIndex String) -- for every category - start/end FCat and a list of label names
- , totalCats :: {-# UNPACK #-} !FCat
+ = ParserInfo { functions :: Array FunId FFun
+ , sequences :: Array SeqId FSeq
+ , productions :: IntMap.IntMap (Set.Set Production) -- the original productions loaded from the PGF file
+ , pproductions :: IntMap.IntMap (Set.Set Production) -- productions needed for parsing
+ , lproductions :: Map.Map CId (IntMap.IntMap (Set.Set Production)) -- productions needed for linearization
+ , startCats :: Map.Map CId (FCat,FCat,Array FIndex String) -- for every category - start/end FCat and a list of label names
+ , totalCats :: {-# UNPACK #-} !FCat
}
@@ -98,22 +99,3 @@ ppFCat fcat ppFunId funid = char 'F' <> int funid
ppSeqId seqid = char 'S' <> int seqid
-
-
-filterProductions = closure
- where
- closure prods0
- | IntMap.size prods == IntMap.size prods0 = prods
- | otherwise = closure prods
- where
- prods = IntMap.mapMaybe (filterProdSet prods0) prods0
-
- filterProdSet prods set0
- | Set.null set = Nothing
- | otherwise = Just set
- where
- set = Set.filter (filterRule prods) set0
-
- filterRule prods (FApply funid args) = all (\fcat -> isLiteralFCat fcat || IntMap.member fcat prods) args
- filterRule prods (FCoerce fcat) = isLiteralFCat fcat || IntMap.member fcat prods
- filterRule prods _ = True
|
