swipldcgtut icon indicating copy to clipboard operation
swipldcgtut copied to clipboard

Need to explain first argument of phrase/2 better

Open Anniepoo opened this issue 7 years ago • 0 comments

Two other remarks regarding phrase/2: You write: To execute a grammar rule, we use Prolog's built-in phrase/2 predicate. The first argument is a DCG body. phrase(Body, Ls) is true iff Body describes the list Ls.

BUT that first argument is the HEAD of the/a “top" rule of a DCG, isn’t it? (It can be the head of a lower rule too of course, if you want to test/find substructures of a DCG.)

Maybe it’s clearer to replace "iff Body describes” with "iff (sub)DCG describes”?

Anniepoo avatar Oct 03 '16 17:10 Anniepoo