The complexity of Languages Generated by Attribute Grammars
The complexity of Languages Generated by Attribute Grammars
复制标题
属性文法生成语言的复杂性
DOI:
10.1137/0215005
复制
发表时间:
1986
期刊:
影响因子:
--
通讯作者:
J. Engelfriet
中科院分区:
文献类型:
--
作者:
J. Engelfriet
A string-valued attribute grammar (SAG) has a semantic domain of strings over some alphabet, with concatenation as basic operation. It is shown that the output language (i.e., the range ofthe translation) of a SAG is log-space reducible to a context-free language. Key words, theory, compilers, attribute grammars, alternation, complexity, classes of languages defined by grammars, by resource-bounded automata CR categories. D3.4, F1.2, F2, F4.3 Introduction. Attribute grammars (AG) are a mechanism for translating the derivation trees of a context-free grammar into values of some semantic domain [26]. A particular, very restricted, domain of interest is the set of strings over some alphabet with concatenation as basic operation. Such "string-valued" attribute grammars (SAG), see [10], are of importance for two reasons. The first reason is that every attribute grammar can be viewed as a SAG. In fact, viewing the right-hand sides of semantic rules of an AG as strings rather than meaningful expressions, a SAG is obtained whose attribute evaluation corresponds to the symbolic evaluation of the attributes of the AG: the SAG translates the derivation trees of the context-free grammar into strings (usually expressions) which eventually may be interpreted again as the values computed by the AG. The second reason that string-valued attribute grammars are important is that they can be used as a language generating mechanism: the range of the translation of a SAG G, denoted OUT (G), is a formal language. If G describes a compiler that translates high-level programs into assembler programs, then OUT (G) is the "assembler dialect spoken by the compiler," i.e., the set of all assembler programs that are the translation of some high-level program. For the more restricted formalism of top-down tree transducers, such "tree transformation languages" were first studied in [32]. In this paper we prove that for every SAG G, OUT (G) is in LOG (CF): the class of languages log-space reducible to context-free languages.. Hence these output languages are recognizable in polynomial time or log square space (on a deterministic Turing machine). The proof of this result was obtained as a generalization of the proof of IO_ LOG (CF) in [2], where IO is the class of inside-out macro languages 19]. In fact, IO is equal to the class of all OUT (G), where G is a SAG with one synthesized attribute (and an arbitrary number of inherited attributes), see [10]. To show that a language L is in LOG (CF), one can use the technique introduced in [36] (and used in [2]) to accept L by a nondeterministic multihead pushdown automaton (MPDA) in polynomial time: the equivalence of polynomial time MPDA and LOG (CF) is shown in [36]. To show that OUT (G) is in LOG (CF) we will use a variation of this technique that concerns alternating multihead finite automata (AMFA) rather than MPDA. It is well-known that AMFA and MPDA accept the same class of languages (viz. PTIME, the class of deterministic polynomial time Turing machine languages, * Received by the editors December 27, 1982, and in final revised form April 15, 1984. " Department of Computer Science, Twente University of Technology, 7500 AE Enschede, the Netherlands. Present address, Department of Mathematics and Computer Science, University of Leiden, Leiden,