Parsing and Compiling Using Prolog

JACQUES COHEN and TIMOTHY J. HICKEY, Parsing and Compiling Using Prolog

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


Издатель: Вольф Александр Владимирович
Опубликовано: 26 января 2008 г. в 15:44:20
Скачиваний: 2784

Предметная область: Программирование.
Ключевые слова: программирование, Prolog.
Выбрать все медиафайлы этого MIME-типа.
Выбрать все медиафайлы этого издателя из данной предметной области.

МедиарепозиторийRSS 2.0 Feed Atom 1.0 Feed