Definite Clause Grammars (DCGs)

Опубликовано: 17 Март 2026
на канале: The Power of Prolog
11,007
244

Prolog has a built-in grammar mechanism, Definite Clause Grammars (DCGs). A DCG describes a sequence, and allows us to conveniently reason about sequences manifested as lists. DCGs are a very versatile mechanism, and one of Prolog's greatest attractions. We use them for parsing, describing output, passing arguments implicitly, reading from files, and several other applications. More information: https://www.metalevel.at/prolog/dcg