1
0
forked from GitHub/gf-core

CFRules tracing.

This commit is contained in:
bringert
2007-06-28 01:26:09 +00:00
parent 448e1db488
commit 731b5c4f98
2 changed files with 7 additions and 1 deletions

View File

@@ -101,7 +101,7 @@ makeSimpleSRG opt s = makeSRG preprocess opt s
. removeCycles
. traceStats "Inital CFG"
traceStats s g = trace (s ++ ": " ++ stats g) g
traceStats s g = trace ("---- " ++ s ++ ": " ++ stats g {- ++ "\n" ++ prCFRules g ++ "----" -}) g
stats g = "Categories: " ++ show (countCats g)
++ " Rules: " ++ show (countRules g)

View File

@@ -369,3 +369,9 @@ isLeftLinear :: Ord c =>
-> CFRule c n t -- ^ The rule to check for left-linearity
-> Bool
isLeftLinear cs = noCatsInSet cs . drop 1 . ruleRhs
prCFRules :: CFRules -> String
prCFRules = unlines . map prRule . allRules
where
prRule r = lhsCat r ++ " --> " ++ unwords (map prSym (ruleRhs r))
prSym = symbol id (\t -> "\""++ t ++"\"")