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.
Due to space constraints, the implementation section has been removed from this version of the paper.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Abramson, H.: Definite Clause Transition Grammars, In: Proc. of the IEEE Logic Programming Symp., Atlantic City, 1984, pp. 233–240
Abramson, H.: Metarules and an approach to conjunction in DCTGs: Some aspects of Grammatical Metaprogramming, In: R.A. Kowalski, K.A. Bowen (eds.): Proc. of the 5th Int. Conf. and Symp. of Logic Programming, Vol. 1, MIT Press 1988, pp. 233–248
Bratko, I.: Prolog: Programming for Artificial Intelligence, 2nd edition, Addison-Wesley 1990
Colmerauer, A.: Metamorphosis Grammars, In: L. Bolc (ed.): Natural Language Communication with Computers, Springer-Verlag 1978
Dahl, V., Abramson, H.: On Gapping Grammars, In: Proc. of the 2nd Int. Conf. on Logic Programming, 1984
O'Keefe, R. A.: The Craft of Prolog, MIT Press 1990
Pareschi, R., Miller, D.: Extending DCGs with Scoping Constructs, In: D.H.D. Warren, P. Szeredi (eds.): Proc. of the 7th Int. Conf. of Logic Programming, MIT Press 1990, pp. 373–389
Pereira, F.C.N., Warren, D.H.D.: Definite Clauses for Language Analysis, Artificial Intelligence, 13 (1980) 231–278
Sterling, L. and Shapiro, E.: The Art of Prolog: Advanced Programming Techniques, MIT Press 1986
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1993 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Davison, A. (1993). Parsing with DCG-terms. In: Voronkov, A. (eds) Logic Programming and Automated Reasoning. LPAR 1993. Lecture Notes in Computer Science, vol 698. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-56944-8_45
Download citation
DOI: https://doi.org/10.1007/3-540-56944-8_45
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-56944-2
Online ISBN: 978-3-540-47830-0
eBook Packages: Springer Book Archive