Нашли опечатку? Выделите ее мышкой и нажмите Ctrl+Enter
Название: Parsing and compiling using Prolog
Авторы: Cohen J., Hickey T.
Аннотация:
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 nonnumerical
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 optimixations. Newly proposed features that are useful in compiler
construction are also discussed. A knowledge of Prolog is assumed.