Skip to main content

Parsing with DCG-terms

  • Conference paper
  • First Online:
Book cover Logic Programming and Automated Reasoning (LPAR 1993)

Part of the book series: Lecture Notes in Computer Science ((LNAI,volume 698))

  • 146 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Abramson, H.: Definite Clause Transition Grammars, In: Proc. of the IEEE Logic Programming Symp., Atlantic City, 1984, pp. 233–240

    Google Scholar 

  2. 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

    Google Scholar 

  3. Bratko, I.: Prolog: Programming for Artificial Intelligence, 2nd edition, Addison-Wesley 1990

    Google Scholar 

  4. Colmerauer, A.: Metamorphosis Grammars, In: L. Bolc (ed.): Natural Language Communication with Computers, Springer-Verlag 1978

    Google Scholar 

  5. Dahl, V., Abramson, H.: On Gapping Grammars, In: Proc. of the 2nd Int. Conf. on Logic Programming, 1984

    Google Scholar 

  6. O'Keefe, R. A.: The Craft of Prolog, MIT Press 1990

    Google Scholar 

  7. 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

    Google Scholar 

  8. Pereira, F.C.N., Warren, D.H.D.: Definite Clauses for Language Analysis, Artificial Intelligence, 13 (1980) 231–278

    Article  Google Scholar 

  9. Sterling, L. and Shapiro, E.: The Art of Prolog: Advanced Programming Techniques, MIT Press 1986

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Andrei Voronkov

Rights and permissions

Reprints 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

Publish with us

Policies and ethics