The Cornell Program Synthesizer: a syntax-directed programming environment

The followin~ is an announcement of the recently developed Cornell Program Syn-thesizer~ first used at the ~979 session of the Cornell Summer School. Additional information and demonstration versions can be obtained from the author. The Cornell Program Synthesizer is a self~contained programming environment with integrated facilities to edit~ files execute and debug programs at a video display ~ermi-halo The principal innovation of the system is its syntax-directed, full-screen editor: entry and modification of program text is guided by a grammar for the host programming languages Because the compiler is incorporated into the editor~ it is normally impossible to create a syntactically incorrect program. All but the simplest statement" types are predefined in the editor as ~o The template is a formatted syntactic skeleton that contains the keywords, matched parentheses and other punctuation marks of the given statement form. The template includes piacenold-ere at each position where additional code is required to complete the statement. The placeholders serve as prompts indicating the syntactic class of each component required to complete the statement° Programs are created top-down by insertimg new statements arid expressions within the skeleton of previously entered templates. Syntax error detection is i~mediate because placeholders can only be replaced by syntactically appropriate inser-tions~ The text of a template is never typed~ rather, it is inserted into the program by commando The effect of each template insertion is instantly visible in the program display. Because a template is immutable, errors are not only prevented on entry, but can not be introduced after the fact. The entire template and its constituent parts can be moved or deleted as a unit. Expressions and assignment statements are typed directly as text. Since the compiler is invoked by the editor on a phrase-by-phrase basis, errors in user-typed tex~ are detected immediately. Most errors are typographical and can be corrected by local edisir~g of the erroneous phrase. It is possible, however, to override the error prevention mechanism when non-local modification is required to correct the program° Erroneous code remaining in the program is then highlighted on the display until corrected. Such highlighted sections are also introduced when changing a declaration introduces non-local errors in the rest of the program. For example, when a declaration is deleted, all phrases containing uses of undeclared variables are ~Lighlighted on the display. The video display allows the incorporation of some unique run time debugging features. The flow of execution through …