Right-hand Context Notation[DCG]

279 Views Asked by At

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

2

There are 2 best solutions below

2
On

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.

19
On

Look for Semicontext notation at DCG Primer: it's well explained, with examples