Non-circularity

Top  Previous  Next

Grammar tests > Non-circularity

 

No non-terminal may be derived from itself, neither directly nor indirectly. The following production is an example for a rule, which hurts this principle:

 

 

Circular1 ::= Circular2 | "T"

Circular2 ::= Circular1 | "T"

 

 

If you parse this rule, following error message will occur:

 

Circular derivation: "Circular1" . "Circular2"

Circular derivation: "Circular2" . "Circular1"

 

 

Remark:

Following rules however are yielding the error message, no being derivable to terminals.

 

Circular1 ::= Circular2

Circular2 ::= Circular1

 

The test of derivability is done before the circularity is found and the second test will not be performed.



This page belongs to the TextTransformer Documentation

Home  Content  German