Skip to main content
Log in

AID: An alternative implementation of DCGs

  • Regular Papers
  • Published:
New Generation Computing Aims and scope Submit manuscript

Abstract

This paper presents an alternative approach to implementation of DCGs. In contrast to the standard implementation we use the well-known bottom-up SLR(1)-parsing technique. An experimental system, AID, based on this technique is presented and discussed. The aim of this work is twofold. Firstly, we describe an alternative principle of implementation of DCGs, which makes it possible to cope with left-recursive DCGs and to avoid unnecessary backtracking when parsing. Secondly, we demonstrate that Prolog can be used for implementation of table driven parsers that generalize deterministic LR(k)-parsing techniques to the case of ambiguous grammars. The parsers generated by our system are deterministic whenever the submitted grammar is SLR(1). Otherwise the shift/reduce or reduce/reduce conflicts are stored in the generalized table and are used as Prolog backtrack points.

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

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Aho, A. and Ullman, J.,Principles of Compiler Design, Addison-Wesley, 1977.

  2. Barklund, J.Logic Programming Seminar, IDA Linköping University (private communication).

  3. Bowen, D. L. (ed.),DECsystem-10 Prolog User’s Manual, DAI, University of Edinburgh, 1982.

  4. Colmerauer, A., “Metamorphosis Grammars”,Natural Language Communication with Computers, Lecture Notes in Computer Science, 63, Springer-Verlag, 1978.

  5. Deransart, P. and Maluszynski, J., “Relating Logic Programs and Attribute Grammars”,Journal of Logic Programming,Vol. 3,No. 2, 1985.

  6. Johnson, S. C.,Yacc: Yet Another Compiler-Compiler, Bell Laboratories, 1978.

  7. Knuth, D. E., “On Translation of Languages From Left to Right”,Information and Control,Vol. 8,No. 6, 1965.

  8. Kowalski, R. A., “Algorithm=Logic+Control”,Comm. ACM,Vol. 22,No. 7, 1979.

  9. Lloyd, J. W.,Foundations of Logic Programming, Springer-Verlag, 1984.

  10. Matsumoto, Y., Tanaka, H., Hirakawa, H., Miyoshi, H. and Yasukawa, H., “BUP: A Bottom-Up Parser Embedded in Prolog”,New Generation Computing, Vol. 1, 1983.

  11. Pereira, F. C. N. and Warren, D. H. D., “Definite Clause Grammars for Language Analysis—A Survey of the Formalism and a Comparison with Augmented Transition Network”,Artificial Intelligence, Vol. 13, 1980.

  12. Uehara, K., Ochitani, R., Kakusho, O., Toyoda, J., “A Bottom-Up Parser Based on Predicate Logic: A Survey of the Formalism and its Implementation Technique”,Proc. 1984 International Symposium on Logic Programming, IEEE, Atlantic City, 1984.

  13. Warren, D. H. D., “Implementing Prolog—Compiling Predicate Logic Programs”,DAI Research Report 39 & 40, University of Edinburgh, 1977.

Download references

Author information

Authors and Affiliations

Authors

About this article

Cite this article

Nilsson, U. AID: An alternative implementation of DCGs. New Gener Comput 4, 383–399 (1986). https://doi.org/10.1007/BF03037391

Download citation

  • Received:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF03037391

Keywords

Navigation