Reputation: 573
in this site, I found a part that explains how to build Right-hand Context Notation using DCG
A → ε | a A
Head, [T_1,...,T_n] --> Body.
someone help me figure out this method by example and illustrate its benefits to parse context-free grammar
Upvotes: 4
Views: 278
Reputation: 60034
Look for Semicontext notation at DCG Primer: it's well explained, with examples
Upvotes: 2
Reputation: 10152
This notation is called a semicontext. See, e.g. this answer. With it you have strictly more power than context-free grammars. In fact, it is already type 0.
Upvotes: 3