Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
Prolog in practical compiler writing
Paakki J. The Computer Journal34 (1):64-72,1991.Type:Article
Date Reviewed: Dec 1 1992

An experiment to assess the suitability of using Prolog’s definite clause grammar (DCG) formalism to write a compiler for moderate-sized languages is reported. The experiment consisted of implementing a compiler for the  EDISON  language using three approaches: DCG, recursive descent in Pascal, and parser generation by an LALR(1) parser  generator. 

The first third of the paper describes the architecture of the compilers. Each compiler consists of four passes: a scanner, a parser that generates an abstract syntax tree, a semantic analyzer that transforms the syntax tree, and a code generator that outputs abstract EDISON code suitable for interpretation. Examples show how EDISON statements are represented and transformed in the Prolog implementation.

Next, the paper compares the development effort and performance of the three implementations. Surprisingly, each implementation took roughly the same amount of time to produce, although the DCG version was half the size of the other two. For the scanner and parser, the DCG implementation was spectacularly slow, in the worst case taking more than 1800 times longer than the Pascal version. (This figure is for compiled Prolog; when run interpretively, it could not finish, due to lack of space on a VAX/8800.)

In the last section, the author gives a long-winded assessment of DCG. Basically, he likes the conceptual approach of DCG, especially for semantic analysis and code generation. He feels that the poor performance of the DCG version is not inherent, but a reflection of the Prolog systems he used. He is working on a compiler-writing system based on Prolog with special support for DCG and symbol-table management.

Reviewer:  A. R. Feuer Review #: CR115600
Bookmark and Share
 
Prolog (D.3.2 ... )
 
 
Compilers (D.3.4 ... )
 
 
Edison (D.3.2 ... )
 
Would you recommend this review?
yes
no
Other reviews under "Prolog": Date
The practice of Prolog
Sterling L. (ed), MIT Press, Cambridge, MA, 1990. Type: Book (9780262193016)
Apr 1 1992
Parlog86 and the dining logicians
Ringwood G. Communications of the ACM 31(1): 10-25, 1988. Type: Article
Feb 1 1989
Why Prolog? Justifying logic programming for practical applications
Lazarev G., Prentice-Hall, Inc., Upper Saddle River, NJ, 1989. Type: Book (9789780139590405)
Dec 1 1989
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy