Work

Syntactic Manipulation Systems for Context-dependent Languages

Year: 1990
Type: article
Abstract: Software developers use many tools to increase their efficiency and improve their software.A syntactic manipulation system (SMS) is one such tool. An SMS is a set of programming-language routines that can be used to create, manipulate, and modify the syntactic structures defined by a grammar. An SMS is useful whenever a program manipulates data objects that are described well by a grammar; programs, structured documents, musical scores, software specifications, mathematical formulae, and recursive data structures are all objects that could be manipulated with an SMS.Previous research has established a method for deriving an SMS from a context-free grammar. Thus, this method produces SMSs that deal abstractly only with those aspects of languages that are captured by context-free grammars. However, experience shows that programs using such SMSs routinely require more complex, context-dependent information. For example, if a program were using an SMS to manipulate Pascal code, it might need answers to the following questions: "What is the type of this variable?""Has NEW been redefined for this scope?""Will this identifier conflict with any existing identifiers?""Where is the resolution for this forward declaration?""Is this argument compatible with that parameter?""What is the value of this constant-expression?" 0 "Where are all the calls to this procedure?" In augmenting context-free SMSs with routines to answer such questions, previous approaches have been ad hoc, with neither a formal strategy to determine what routines should be added, nor a method for deriving them from a description of the target-language. This thesis provides a systematic approach to replace the previous ad hoc approaches. Specifically, I have devised NURN, a notation for specifying context-dependent languages in terms of relations between the nodes of context-free abstract syntax-trees. Moreover, I have implemented Ginger, a system that takes a NURN grammar and generates the corresponding context-dependent SMS.To demonstrate the usefulness of NURN and Ginger, I have used NURN to fully define the syntax of Standard Pascal, and written a Pascal syntax-checker using the resulting SMS.iii CHAPTER 1 RELATION DEF te is-an-integer-type :t is-the-MG-type-for te, t istheinteger-type whereupon the NURN phrase can be written: expr is-a-Expression, te is-the-type-of expr, te is-an-integer-type 3.4.5Summary As we have seen, NURN handles the type system of Pascal quite well, even the anomalous features. Also, NURN rules can be written using phrasing close to what one would write naturally in a language specification.
Author: Michael K. Dyck
Language: English
Subfield: Software
Open Access status: green
OpenAlex ID: W2165545265
FWCI: 1.121
Cites: 9
Cited by: 2
Related to: 10