Abstract

Definite Clause Grammars (DCGs) are powerful adjuncts to Prolog, permitting the clear and succinct encoding of parsers and other grammar related programs. Normally, a DCG is incorporated into a Prolog program by being treated as a special set of predicates. This paper utilises DCGs in a different way, by augmenting the unification algorithm with DCG-terms. More importantly, this notation allows token lists to be constructed and deconstructed by reference to nonterminal names. Examples in the parsing domain are used to illustrate these ideas, and show how programs are improved. In particular, searches for sublists of tokens of different types can be expressed simply, without having to complicate the underlying DCG. Also, the DCG part of a program is more independent of the other code, which makes both easier to debug and modify.KeywordsLogic ProgramToken ListParse TreeHorn ClauseModule LanguageThese keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call