Różnice
Różnice między wybraną wersją a wersją aktualną.
|
|
pl:prolog:pllib:dcg_contextless [2019/06/27 15:50] |
pl:prolog:pllib:dcg_contextless [2019/06/27 15:50] (aktualna) |
| ====== Dcg contextless ====== |
| {{tag>DCG linguistics}} |
| ===== Description ===== |
| A DCG context-free grammar |
| |
| **Source**: The Art of Prolog |
| ===== Download ===== |
| Program source code: {{dcg_contextless.pl}} |
| ===== Listing ===== |
| <code prolog> |
| % Grammar Rules |
| |
| sentence --> noun_phrase, verb_phrase. |
| |
| noun_phrase --> determiner, noun_phrase2. |
| noun_phrase --> noun_phrase2. |
| |
| noun_phrase2 --> adjective, noun_phrase2. |
| noun_phrase2 --> noun. |
| |
| verb_phrase --> verb. |
| verb_phrase --> verb, noun_phrase. |
| |
| % Vocabulary |
| |
| determiner --> [the]. adjective --> [decorated]. |
| determiner --> [a]. |
| |
| noun --> [pieplate]. verb --> [contains]. |
| noun --> [surprise]. |
| |
| % Program 19.6: A DCG context-free grammar |
| </code> |
| ===== Comments ===== |
| |