scispace - formally typeset
Search or ask a question

Showing papers on "L-attributed grammar published in 1981"


Proceedings ArticleDOI
26 Jan 1981
TL;DR: The advantages of attribute grammars as a specification technique for a syntax-directed editing system are discussed and an efficient algorithm for incrementally evaluating attributes as a program tree is derived is presented.
Abstract: A syntax-directed editor is a tool for structured program development. Such an editor can enforce syntactic correctness incrementally by restricting editing operations to legitimate modifications of the program's context-free derivation tree. However, not all language features can be described by the context-free formalism. To build editors that enforce non-context-free correctness, a more powerful specification technique is needed. In this paper we discuss the advantages of attribute grammars as a specification technique for a syntax-directed editing system. We also present an efficient algorithm for incrementally evaluating attributes as a program tree is derived.

186 citations


Journal ArticleDOI
TL;DR: The class of output languages of 1V (or L) attribute grammars is the image of the class of IO macro tree languages under all deterministic top-down tree transductions.
Abstract: An attribute grammar is one-visit if the attributes can be evaluated by walking through the derivation tree in such a way that each subtree is visited at most once. One-visit (1V) attribute grammars are compared with one-pass left-to-right (L) attribute grammars and with attribute grammars having only one synthesized attribute (1S). Every 1S attribute grammar can be made one-visit. One-visit attribute grammars are simply permutations of L attribute grammars; thus the classes of output sets of 1V and L attribute grammars coincide, and similarly for 1S and L-1S attribute grammars. In case all attribute values are trees, the translation realized by a 1V attribute grammar is the composition of the translation realized by a 1S attribute grammar with a deterministic top-down tree transduction, and vice versa; thus, using a result of Duske e.a., the class of output languages of 1V (or L) attribute grammars is the image of the class of IO macro tree languages under all deterministic top-down tree transductions.

57 citations


Journal ArticleDOI
TL;DR: This paper shows that any attribute grammar G has a reformulation MS (G) within mathematical semantics, and shows that for a grammar G with one of these properties both MS ( G) and the compiler for G can be simplified.
Abstract: Attribute grammars and mathematical semantics are rival language definition methods. We show that any attribute grammar G has a reformulation MS (G) within mathematical semantics. Most attribute grammars have properties that discipline the sets of equations the grammar gives to derivation trees. We list six such properties, and show that for a grammar G with one of these properties both MS (G) and the compiler for G can be simplified. Because these compiler-friendly properties are of independent interest, the paper is written in such a way that the first and last sections do not depend on the other sections.

43 citations


Book
01 Jan 1981
TL;DR: I would like to thank my friends for all the authors shared during my years at Stanford, and if not for Randy Gellerman, this work would have been completed much sooner.
Abstract: Acknowledgements For the past three years, John Hennessy has assisted my study of programming languages. He suggested that I investigate semantics, and later noted that the compiler generator might be feasible. As the research progressed, John helped me t o focus on the most important problems. He made extensive comments on numerous drafts of this thesis and other papers. Zohar Manna and Gio Wiederhold have taken an interest in my career ever since I came to Stanford. Zohar introduced me to denotational semantics; recently, he got me several job offers. Sue Owicki made several insightful comments about the dissertation; Jeff Ullman pointed out that I had omitted some important material. Wolf Polak informed me of people who were doing related work; Ole L. Madsen sent a wealth of research reports. Of Stanford's capable and underpaid staff, Carolyn Tajnai kept me posted on all the deadlines and requirements, and was the friendliest person in the Department. Betty Scott resolved the quarterly funding emergencies. I would like to thank my friends for all we shared during my years at Stanford. Special thanks to Bob and Anne.. If not for Randy Gellerman, this work would have been completed much sooner.

33 citations


Journal ArticleDOI
TL;DR: A practical method is presented for extending the lookahead of LR parsers, by the addition of “reduce-arcs,” which gives a machine which is close in size to the corresponding LALR(1) machine, but is capable of making use of unbounded lookahead.

29 citations


Journal ArticleDOI
TL;DR: This work provides a characterization of the class of context-free string languages in terms of DNLC grammars, and studies the use of those Grammars to define string languages.
Abstract: Directed node-label controlled graph grammars (DNLC grammars) are sequential graph rewriting systems. In a direct derivation step of a DNLC grammar a single node is rewritten. Both the rewriting of a node and the embedding of a "daughter graph" in a "host graph" are controlled by the labels of nodes only. We study the use of those grammars to define string languages. In particular we provide a characterization of the class of context-free string languages in terms of DNLC grammars.

28 citations


Journal ArticleDOI
TL;DR: LL and LC tests, as well as inclusion theorems for the classes of LL, LC, and LR grammars will be based on parsing automata, too, because deRemer's and Pager's parsing methods turn out to be special cases.

27 citations


Journal ArticleDOI
TL;DR: Examination of extant grammars shows that a vast majority of attributes are indeed one-pass, and therefore the scheme presented can greatly reduce the storage requirements of an attribute grammar evaluator.
Abstract: A space-efficient strategy for storing attributes during evaluation of an attribute grammar is presented. Attributes are classified as either one-pass or multipass. One-pass attributes are stored on a pushdown stack, and their storage is freed when no longer needed. Examination of extant grammars shows that a vast majority of attributes are indeed one-pass, and therefore the scheme presented can greatly reduce the storage requirements of an attribute grammar evaluator. Several approaches to storage management for multipass attributes are also presented. Data for several grammars are collected and used to show the effectiveness of the proposed storage management scheme.

25 citations


Journal ArticleDOI
TL;DR: A simple portable interpreter for testing the specifications of problems is presented and specificiations are supposed to be expressed in the formalism of attribute grammars, so that the parsing can be directed by the semantics.
Abstract: A simple portable interpreter for testing the specifications of problems is presented in this paper. These specificiations are supposed to be expressed in the formalism of attribute grammars. The parsing and the semantics evaluation are carried out simultaneously, so that the parsing can be directed by the semantics. This increases the power of the grammars and context sensitive characteristics of a language can be described.

21 citations


Journal ArticleDOI
TL;DR: It is shown that any deterministic algorithm which solves the circularity problem for a grammar must for infinitely many cases use an exponential amount of time.
Abstract: Attribute grammars are an extension of contextfree grammars devised by Knuth as a mechanism for including the semantics of a context-free language with the syntax of the language. The circularity problem for a grammar is to determine whether the semantics for all possible sentences (programs) in fact will be well defined. It is proved that this problem is, in general, computationally intractable. Specifically, it is shown that any deterministic algorithm which solves the problem must for infinitely many cases use an exponential amount of time. An improved version of Knuth's circularity testing algorithm is also given, which actually solves the problem within exponential time.

19 citations


Journal ArticleDOI
TL;DR: It is shown that every “recursively enumerable tree language” can be obtained from a recognizable dag language by such a transduction, and tree languages obtained from some subsets of recognizable dag languages by these transductions are investigated.
Abstract: Directed acyclic graphs (dags) model derivations of phrasestructure grammars analogously to the way that trees model derivations of context-free grammars.

Journal ArticleDOI
TL;DR: Sequential and parallel ways of rewriting are investigated and compared in the framework of selective substitution grammars, and several new characterizations of known classes of languages are obtained.
Abstract: Sequential and parallel ways of rewriting are investigated and compared in the framework of selective substitution grammars. New aspects of the notion of generative determinism of a grammar and of the notion of symmetric context are studied. Several new characterizations of known classes of languages are obtained.

Journal ArticleDOI
TL;DR: The proofs are based on a characterization of pure multi-pass attribute grammars in terms of paths through their dependency graphs, and it is shown that the problem of determining whether an arbitrary attribute grammar is pure multipass, is of inherently exponential time complexity.
Abstract: An attribute grammar is pure (left-to-right) multi-pass if a bounded number of left-to-right passes over the derivation tree suffice to compute all its attributes. There is no requirement, as for the usual multi-pass attribute grammars, that all occurrences of the same attribute are computed in the same pass. It is shown that the problem of determining whether an arbitrary attribute grammar is pure multipass, is of inherently exponential time complexity. For fixed k > 0, it can be decided in polynomial time whether an attribute grammar is pure k-pass. The proofs are based on a characterization of pure multi-pass attribute grammars in terms of paths through their dependency graphs. A general result on dependency paths of attribute grammars relates them to (finite-copying) top-down tree transducers. The formal power of k-pass attribute grammars increases with increasing k. Formally, multi-pass attribute grammars are less powerful than arbitrary attribute grammars.

Journal ArticleDOI
TL;DR: It is shown that any well-defined attribute grammar isk-visit for somek and that given a well- defined grammarG and an integerk, it is decidable whetherG isk -visit.
Abstract: It is shown that any well-defined attribute grammar isk-visit for somek. Furthermore it is shown that given a well-defined grammarG and an integerk, it is decidable whetherG isk-visit. Finally we show that thek-visit grammars specify a proper hierarchy with respect to translations.

Journal ArticleDOI
TL;DR: This paper shows how the notation for translation grammars may be used to derive a program in a conventional high level language such as Pascal or Cobol, and it is shown that more complex problems can be solved by simple pipeline structures of simple translations.
Abstract: A method of program design is described which leads naturally to the expression of a program as a pipeline network of simple processes. Starting from the problem statement the valid inputs and outputs are specified by grammars, which can be combined to define the requisite translation. A notation for translation grammars is described informally which allows a translation to take into account semantic as well as syntactic information. Terminal symbols may be attributed by data types and may be qualified by Boolean expressions. The notation is capable of direct compilation but in this paper we show how it may be used to derive a program in a conventional high level language such as Pascal or Cobol. It is shown that more complex problems can be solved by simple pipeline structures of simple translations. Provided that nonbacktracking grammars are used to specify translations, the pipeline structure is well-suited to concurrent execution on a multiprocessor. The method is illustrated by examples from data processing.

Journal ArticleDOI
TL;DR: A new characterization for attribute grammars evaluable in passes is developed, which can be directly applied as an efficient membership test and used for deriving a polynomial time construction algorithm for a large subclass of pass-oriented attribute Grammars.
Abstract: The problem of constructing multi-pass evaluators for attribute grammars is studied. We show that the construction algorithm used heretofore can in the worst case produce evaluators which perform $2n - 1$ passes over the parse tree, where n is the minimum number of passes required. Furthermore, the problem of constructing an optimal evaluation order is shown to be NP-complete. We then develop a new characterization for attribute grammars evaluable in passes. It can be directly applied as an efficient membership test. Finally, the characterization is used for deriving a polynomial time construction algorithm for a large subclass of pass-oriented attribute grammars. The subclass is argued to be of practical importance.

Book ChapterDOI
19 Apr 1981
TL;DR: This paper is intended to provide a introduction to attribute grammars, a discussion of open problems with a (highly subjective) selection of relevant references and a brief account on the author and P. FRANCHI-ZANNETTACCI's contribution to the subject.
Abstract: This paper is intended to provide a introduction to attribute grammars, a discussion of open problems with a (highly subjective) selection of relevant references and a brief account on the author and P. FRANCHI-ZANNETTACCI's contribution to the subject.

Proceedings ArticleDOI
26 Jan 1981
TL;DR: This paper proposes a verification procedure for proving the correctness of attribute grammar, which is applicable to the wide class of attribute grammars called absolutely noncircular ones and can be extended to accept anyNoncircular attribute grammar since it is shown that any noncircULAR attribute grammar is transformed into an equivalent absolutely non Circular one.
Abstract: Verification of attribute grammar is discussed. As is widely recognized, attribute grammar of Knuth [8] is a very convenient device to describe semantics of programming languages, especially in automating compiler construction. Many efforts have been made to obtain efficient evaluators for attribute grammar [1,3,4,5,7,10] so that efficient compilers may be produced from the semantic specifications written in the attribute grammar.There is another important problem about the semantic specifications. This is how to verify the correctness of the specification and is essential in ascertaining the correctness of produced compilers. In contrast with the evaluation problem, this has not been studied well and only a few partial results have been reported up to now [2,9].In this paper we propose a verification procedure for proving the correctness of attribute grammar, which is applicable to the wide class of attribute grammars called absolutely noncircular ones [7]. Our method can be extended to accept any noncircular attribute grammar since it is shown that any noncircular attribute grammar is transformed into an equivalent absolutely noncircular one [5].Our verification procedure utilizes dependency relations among attributes and verification is performed by induction based on this order relation, according to which attributes are evaluated. This procedure consists of (1) assigning assertions to relevant pairs of a nonterminal symbol and a parallelly evaluable subset of its attributes, (2) generating a set of verification conditions for each production rule with the aid of dependency graph of the rule and (3) proving the verification conditions. Of course, verification is performed production-rule-wise.Our method can accept attribute grammars which contain both synthesized and inherited attributes and handle them in a well-formed way. This contrasts to the previous works where only the synthesized case is considered [2] or there seems no general and formal descriptions about how to verify general attribute grammars [9].In this paper we first give necessary definitions and notations for attribute grammar and then propose a verification procedure to prove its correctness. After giving some examples of verification, we establish consistency and completeness of our procedure.

Journal ArticleDOI
TL;DR: An LR parsing technique based on an underlying transformation of the grammar into an equivalent context-free one is presented, which is suitable for inclusion in one-pass compilers and is compared with other proposals appeared in the literature.

Journal ArticleDOI
TL;DR: Selective substitution array grammars are introduced, which abstract the notions of rewriting rules, direct derivation steps, derivations and rewriting in a sequential or parallel way to provide a unified framework for many of the two-dimensional array Grammars in the literature.

Journal ArticleDOI
01 Jun 1981
TL;DR: Two new formalisms are introduced: extended attribute Grammars, which are capable of defining completely the syntax of programming languages, and extended attributed trans!ation grammars which are additionally capable of defines their semantics by translation.
Abstract: Two new formalisms are introduced: extended attribute grammars, which are capable of defining completely the syntax of programming languages, and extended attributed trans!ation grammars, which are additionally capable of defining their semantics by translation. These grammars are concise and readable, and their suitability for language definition is demonstrated by a realistic example. The suitability of a large class of these grammars for compiler construction is also established, by borrowing the techniques already developed for attribute grammars and affix grammars. Revised version of Glasgow Report No.10

Book ChapterDOI
31 Aug 1981
TL;DR: After the introduction of context-free grammars and the use of BNF rules, compilers have been built in which compilers can distinguish methods of syntax-analysis and each of these methods can be shown to be suitable for a certain subclass of the context- free grammARS.
Abstract: After the introduction of context-free grammars and the use of BNF rules, compilers have been built in which we can distinguish methods of syntax-analysis. While initially sometimes many different ideas were used to do syntax-analysis for a given programming language and grammar, later formalizations of these ideas have led to many different parsing methods. Each of these methods can be shown to be suitable for a certain subclass of the context-free grammars.

Journal ArticleDOI
TL;DR: Algorithms are presented for constructing sets of equivalent nonterminals for an expansive tree grammar, for reducing the grammar, and for determining whether two grammars generate the same language.
Abstract: The equivalence of nonterminals of an expansive tree grammar is considered. Algorithms are presented for constructing sets of equivalent nonterminals for an expansive tree grammar, for reducing the grammar, and for determining whether two grammars generate the same language.

Journal ArticleDOI
01 Nov 1981
TL;DR: By requiring that each derivation tree has a computation sequence with a certain property, it is possible to give simple characterizations of well-known subclasses of attribute grammars.
Abstract: A computation sequence for a derivation tree specifies a way of walking through the tree evaluating all the attributes of all nodes. By requiring that each derivation tree has a computation sequence with a certain property, it is possible to give simple characterizations of well-known subclasses of attribute grammars. Especially the absolutely well-defined attribute grammars are considered.

Book ChapterDOI
24 Aug 1981
TL;DR: It is shown that the equivalence problem for LL-regular grammars is decidable by reducing it to the equivalences problem for real-time strict deterministic Grammars.
Abstract: The equivalence problem for context-free grammars is "given two arbitrary grammars, do they generate the same language?" Since this is undecidable in general, attention has been restricted to decidable subclasses of the context-free grammars. For example, the classes of LL(k) grammars and real-time strict deterministic grammars. In this paper it is shown that the equivalence problem for LL-regular grammars is decidable by reducing it to the equivalence problem for real-time strict deterministic grammars. Moreover, we show that the LL-regular equivalence problem is a special case of a more general equivalence problem which is also decidable. Our techniques can also be used to show that the equivalence problem for LR-regular grammars is decidable if and only if the equivalence problem for LR(0) grammars is decidable.

Journal ArticleDOI
01 Nov 1981
TL;DR: This work gives a simple but general construction of an evaluator for any well-defined attribute grammar and proves its correctness.
Abstract: An evaluator for an attribute grammar takes a derivation tree as input and produces a computation sequence for it as output. We give a simple but general construction of an evaluator for any well-defined attribute grammar and we prove its correctness. Evaluators for seueral subclasses of attribute grammars can be constructed by changing a preprocessing stage of the evaluator.

Book ChapterDOI
31 Aug 1981
TL;DR: Structural complexity of context-free languages is studied for the description of context -free languages by position restricted grammars.
Abstract: Structural complexity of context-free languages is studied for the description of context-free languages by position restricted grammars.

Journal ArticleDOI
TL;DR: There exist two distinct infinite hierarchies of AFG which exhaust the derivation bounded AFG and are shown to be strongly incomparable to the other; that is, the first member of each generates some language not generated by a fixed but arbitrary member of the other.
Abstract: An abstract family of grammars (AFG) may be defined as a class of grammars for which the corresponding class of languages forms an abstract family of languages (AFL) as defined by Ginsburg and Greibach. The derivation bounded grammars of Ginsburg and Spanier is an example of an AFG which is properly included in the class of all context-free grammars (also AFG). The main result is that there exist two distinct infinite hierarchies of AFG which exhaust the derivation bounded AFG such that the AFL associated with the kth member of one of these AFG hierarchies is properly included in the AFL associated with the k-lst member of that same hierarchy. Each hierarchy is shown to be strongly incomparable to the other; that is, the first member of each generates some language not generated by a fixed but arbitrary member of the other. We designate these hierarchies as the hierarchies of left and right dominant grammars (languages)

Journal ArticleDOI
Richard A. Upton1
TL;DR: Two major results concerning extended tree adjunct grammars are the primary focus of this article, namely that any recognizable set can be realized as the tree set of such a grammar and that a special form of automaton is sufficient to recognize this new class of tree adjunct Grammars.
Abstract: A new class of tree adjunct grammars is examined which was first introduced in (Joshi et al., 1975). Termed extended tree adjunct grammars, they provide for a more flexible, localized notion of adjunction than is possible within the context of standard tree adjunct grammars. In fact, this new class is more powerful than that of standard tree adjunct grammars since the latter is properly included in the former. The study of extended tree adjunct grammars is motivated by several linguistic considerations relating to weaknesses in the power of standard tree adjunct grammars. First, standard tree adjunct grammars, which can be used to compose the phrase structure grammar of the base component of a Chomsky-like transformational grammar, are not well suited to account for certain aspects of language structure such as the establishment and confirmation of selectional restrictions. Second, since the relational and categorical aspects of structure are simultaneously entailed by the process of adjunction in standard tree adjunct grammars, it is difficult to study each separately. Finally, standard tree adjunct grammars by their very nature do not admit a satisfactory description of the concept of the center of a constituent. Two major results concerning extended tree adjunct grammars are the primary focus of this article. The first and foremost is that any recognizable set can be realized as the tree set of such a grammar. The second is that a special form of automaton, called a deterministic linear bounded tree automaton, is sufficient to recognize this new class of tree adjunct grammars.

Book ChapterDOI
24 Aug 1981