Affiliation:
1. Brandeis Univ., Waltham, MA
Abstract
This paper presents the material needed for exposing the reader to the advantages of using Prolog as a language for describing succinctly most of the algorithms needed in prototyping and implementing compilers or producing tools that facilitate this task. The available published material on the subject describes one particular approach in implementing compilers using Prolog. It consists of coupling actions to recursive descent parsers to produce syntax-trees which are subsequently utilized in guiding the generation of assembly language code. Although this remains a worthwhile approach, there is a host of possibilities for Prolog usage in compiler construction. The primary aim of this paper is to demonstrate the use of Prolog in parsing and compiling. A second, but equally important, goal of this paper is to show that Prolog is a labor-saving tool in prototyping and implementing many non-numerical algorithms which arise in compiling, and whose description using Prolog is not available in the literature. The paper discusses the use of unification and nondeterminism in compiler writing as well as means to bypass these (costly) features when they are deemed unnecessary. Topics covered include bottom-up and top-down parsers, syntax-directed translation, grammar properties, parser generation, code generation, and optimizations. Newly proposed features that are useful in compiler construction are also discussed. A knowledge of Prolog is assumed.
Publisher
Association for Computing Machinery (ACM)
Reference31 articles.
1. BACKHOUSE R.C. Syntax o{ Programming Languages. Prentice-Hall Englewood Cliffs N.J. 1979. BACKHOUSE R.C. Syntax o{ Programming Languages. Prentice-Hall Englewood Cliffs N.J. 1979.
2. CAMPBELL J. A. (ED.) Implementations o{Prolog. Wiley New York 1984. CAMPBELL J. A. (ED.) Implementations o{Prolog. Wiley New York 1984.
3. Automatic Derivation of Code Generators from Machine Descriptions
Cited by
35 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献