diff options
| author | bringert <bringert@cs.chalmers.se> | 2006-12-17 19:18:28 +0000 |
|---|---|---|
| committer | bringert <bringert@cs.chalmers.se> | 2006-12-17 19:18:28 +0000 |
| commit | c7df9f4167f7b554a93a216245a013e16cca420d (patch) | |
| tree | 77be7e4fadb2c86f2583c58cf5e8d255a68829b8 /src/GF/Speech/PrJSGF.hs | |
| parent | 4e592d495e402bb8e73f860197315654c3958ae4 (diff) | |
Added still unused implementation of Moore's LCLR algorithm for left recursion elimination. Fixed top category generation for SRG (included LR-elimination-added categories before).
Diffstat (limited to 'src/GF/Speech/PrJSGF.hs')
| -rw-r--r-- | src/GF/Speech/PrJSGF.hs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/GF/Speech/PrJSGF.hs b/src/GF/Speech/PrJSGF.hs index 90e8678f1..05aa6562c 100644 --- a/src/GF/Speech/PrJSGF.hs +++ b/src/GF/Speech/PrJSGF.hs @@ -44,7 +44,7 @@ jsgfPrinter name start opts sisr probs cfg = prJSGF srg sisr "" where srg = makeSimpleSRG name start opts probs cfg prJSGF :: SRG -> Maybe SISRFormat -> ShowS -prJSGF (SRG{grammarName=name,startCat=start,origStartCat=origStart,rules=rs}) sisr +prJSGF srg@(SRG{grammarName=name,startCat=start,origStartCat=origStart,rules=rs}) sisr = header . nl . mainCat . nl . unlinesS topCatRules . nl @@ -62,9 +62,8 @@ prJSGF (SRG{grammarName=name,startCat=start,origStartCat=origStart,rules=rs}) si -- FIXME: use the probability prAlt (EBnfSRGAlt mp n rhs) = tag sisr (profileInitSISR n) . showChar ' '. prItem sisr rhs - topCatRules = [rule True (catFormId tc) (map (it tc) cs) | (tc,cs) <- topCats] - where topCats = buildMultiMap [(cfgCatToGFCat origCat, cat) | SRGRule cat origCat _ <- rs] - it i c = prCat c . tag sisr [(EThis :. catFieldId i) := (ERef c)] + topCatRules = [rule True (catFormId tc) (map (it tc) cs) | (tc,cs) <- srgTopCats srg] + where it i c = prCat c . tag sisr [(EThis :. catFieldId i) := (ERef c)] catFormId :: String -> String catFormId = (++ "_cat") |
