Extended Pascal is no problem

Jon Mauney · ACM SIGPLAN Notices · 1989

R. T. House complains [1] that the extension of Pascal to permit constant expressions causes serious parsing difficulties, and that in particular the language becomes LL(4).In fact, the parsing problems are not that difficult to overcome, and parsing top-down or bottom-up with one-symbol lookahead is quite feasible.Before showing the solution to the parsing problem, I would like to discuss the more general language design issues involved.House asserts that the language extension greatly complicates the compiler, quotes Wirth in saying that a simple compiler is important, and lists possible restrictions on constant expressions that simplify the compiler.However, he overlooks two important points:# Restricting the use of constant expressions would complicate the language and complicating the language is always a greater sin than complicating the compiler.The only choice then is whether to accept the complicated compiler or to reject the language extension.® The only complication involved with this extension is that the compiler must buffer some data and delay certain semantic actions until more right context has been seen.This is child's play compared to the complicated features of, say, Ada or PL/I.

Read the paper · More papers on PaperTik