1
0
forked from GitHub/gf-core

Added srg0006: A grammar with a cycle caused by an empty production.

This commit is contained in:
bringert
2007-03-25 16:11:51 +00:00
parent 4331167011
commit 85072fb6b2
2 changed files with 11 additions and 1 deletions

View File

@@ -88,7 +88,7 @@ stateGFCC = mkGFCC . mkCanon2gfcc . stateGrammarST
-- * Grammar filtering
-- | Removes all directly cyclic productions.
-- | Removes all directly and indirectly cyclic productions.
removeCycles :: CFRules -> CFRules
removeCycles = groupProds . removeCycles_ . ungroupProds
where removeCycles_ rs = [r | r@(CFRule c rhs _) <- rs, rhs /= [Cat c]]

View File

@@ -0,0 +1,10 @@
-- A grammar with a cycle caused by an empty category.
cat S; E;
fun f : E -> S -> S;
fun g : S ;
fun e : E ;
lin f e s = { s = e.s ++ s.s } ;
lin g = { s = "s" } ;
lin e = { s = [] } ;