32 research outputs found
Static and Dynamic Coupling Attribute Evaluators
Projet CHARMESeveral years ago, the notion of attribute coupled grammars was introduced by Ganzinger and Giegerich,[.ganzinger giegerich montreal.] together with their descriptional composition. The latter works essentially at the specification level, i.e., it produces an attribute grammar which specifies the composition of two attribute coupled grammars. We introduce a new approach to this composition of attribute coupled grammars. It no longer works at the specification level but rather at the evaluator level. It produces a special kind of attribute evaluator, called {\em coupling evaluator}. We present both a static version and a dynamic version of coupling evaluators. Both versions retain the good property of descriptional composition that intermediate trees are not physically constructed. In addition---and this is the main advantage of our approach, compared with descriptional composition---, it is possible to build separately the dynamic coupling evaluator of each attribute coupled grammar; in other words we achieve real {\em separate compilation\/} of AG modules
Recommended from our members
Translating Between Programming Languages Using A Canonical Representation And Attribute Grammar Inversion
Automatic translation between programming languages is an important tool for increasing program reusability. Often the need arises to transport a large software system from one source language environment to another. Performing such a translation by hand is a large undertaking, costly in manpower and very error-prone. For this reason, several researchers have built automated tools to aid them in particular such projects [3, 1]. In this paper we present a new methodology for building source-to-source translators. This methodology involves designing a canonical form to represent programs of all source languages involved, and using attribute grammars (AGs) and automatic AG-inversion to build bidirectional translators between the various source languages and the canonical form. To test the feasibility of these ideas, we have created a system to translate between the C and Pascal programming languages
Correctness Preserving Transformations on a Multipass Occam Compiler
The verification of a compiler may be a substantial task. However, by introducing correctness preserving program transformations some automated assistance becomes available. The idea is to specify an initial multipass compiler, to verify it in the usual way and then, while preserving the overall correctness result, to transform it into a more efficient single pass compiler. This transformation process may be performed using the fold/unfold framework of Burstall and Darlington and automation is provided by the Flagship Programming Environment. We illustrate this transformation process on a compiler for a subset of Occam
Recommended from our members
The Automatic Inversion of Attribute Grammars
Over the last decade there has developed an acute awareness of the need to introduce abstraction and mathematical rigor into the programming process. This increased formality allows for the automatic manipulation of software, increasing productivity and, even more importantly, the manageability of complex systems. Along these lines, attribute grammars constitute a formal mechanism (or specifying translations between languages; from a Cormal description of the translation a translator can be automatically constructed. In this paper we consider taking this process one step further: given an attribute grammar specifying the translation from language L1 to the language L2, we address the question of whether the inverse attribute grammar specifying the inverse translation from L2 to L1 can be automatically generated. We show how to solve this problem for a restricted subset of attribute grammars. This inversion process allows for compatible two-way translators to be generated from a single description. To show the practical feasibility of attribute grammar inversion, we relate our experience in inverting an attribute grammar used as an interface for a formal database accessing language, SQL. The attribute grammar is used to paraphrase SQL database queries in English
属性付き記号的木変換器の合成
関数プログラミングでは,関数間で受け渡される中間的な計算結果に関するコストを削減するため,2つの関数の連続する適用を,中間的な計算結果を介さない1つの関数の適用で置き換える関数融合と呼ばれる最適化が重要である.蓄積引数を伴う再帰プログラムを関数融合により最適化するには,属性付き木変換器の合成アルゴリズムを応用する手法が有効であることが知られている.しかしこの手法は,2つの関数がいずれもパターンマッチのガード式を扱う場合には対応していない.また,従来の木変換器は,有限の領域しか扱えないため,無限の領域に関する条件を記述したガード式を扱うことができない.これらの問題点を解決するため,本論文では,最も基本的な木変換器を無限の領域に対応させた記号的木変換器と同様の拡張手法を,属性付き木変換器に対して行うことで,無限の領域を扱うことが可能な属性付き記号的木変換器を提案する.そして,属性付き記号的木変換器で表現できる計算のクラスが記号的木変換器のクラスより大きいことを示す.さらに,記号的木変換器の合成で用いる手法を属性付き木変換器の合成アルゴリズムに取り入れることで,属性付き記号的木変換器の合成アルゴリズムを構成し,その正当性を証明する.証明では,属性付き記号的木変換器を,見かけ上等価な属性付き木変換器へ符号化することで,属性付き木変換器の合成アルゴリズムの正当性に帰着する.電気通信大学201
XML stream transformer generation through program composition and dependency analysis
AbstractXML stream transformation, which sequentially processes the input XML data on the fly, makes it possible to process large sized data within a limited amount of memory. Though being efficient in memory-use, stream transformation requires stateful programming, which is error-prone and hard to manage.This paper proposes a scheme for generating XML stream transformers. Given an attribute grammar definition of transformation over an XML tree structure, we systematically derive a stream transformer in two steps. First, an attribute grammar definition of the XML stream transformation is inferred by applying a program composition method. Second, a finite state transition machine is constructed through a dependency analysis. Due to the closure property of the program composition method, our scheme also allows modular construction of XML stream transformers.We have implemented a prototype XML stream transformer generator, called altSAX. The experimental results show that the generated transformers are efficient in memory consumption as well as in execution time
XML stream transformer generation through program composition and dependency analysis
AbstractXML stream transformation, which sequentially processes the input XML data on the fly, makes it possible to process large sized data within a limited amount of memory. Though being efficient in memory-use, stream transformation requires stateful programming, which is error-prone and hard to manage.This paper proposes a scheme for generating XML stream transformers. Given an attribute grammar definition of transformation over an XML tree structure, we systematically derive a stream transformer in two steps. First, an attribute grammar definition of the XML stream transformation is inferred by applying a program composition method. Second, a finite state transition machine is constructed through a dependency analysis. Due to the closure property of the program composition method, our scheme also allows modular construction of XML stream transformers.We have implemented a prototype XML stream transformer generator, called altSAX. The experimental results show that the generated transformers are efficient in memory consumption as well as in execution time
Linear Bounded Composition of Tree-Walking Tree Transducers: Linear Size Increase and Complexity
Compositions of tree-walking tree transducers form a hierarchy with respect
to the number of transducers in the composition. As main technical result it is
proved that any such composition can be realized as a linear bounded
composition, which means that the sizes of the intermediate results can be
chosen to be at most linear in the size of the output tree. This has
consequences for the expressiveness and complexity of the translations in the
hierarchy. First, if the computed translation is a function of linear size
increase, i.e., the size of the output tree is at most linear in the size of
the input tree, then it can be realized by just one, deterministic,
tree-walking tree transducer. For compositions of deterministic transducers it
is decidable whether or not the translation is of linear size increase. Second,
every composition of deterministic transducers can be computed in deterministic
linear time on a RAM and in deterministic linear space on a Turing machine,
measured in the sum of the sizes of the input and output tree. Similarly, every
composition of nondeterministic transducers can be computed in simultaneous
polynomial time and linear space on a nondeterministic Turing machine. Their
output tree languages are deterministic context-sensitive, i.e., can be
recognized in deterministic linear space on a Turing machine. The membership
problem for compositions of nondeterministic translations is nondeterministic
polynomial time and deterministic linear space. The membership problem for the
composition of a nondeterministic and a deterministic tree-walking tree
translation (for a nondeterministic IO macro tree translation) is log-space
reducible to a context-free language, whereas the membership problem for the
composition of a deterministic and a nondeterministic tree-walking tree
translation (for a nondeterministic OI macro tree translation) is possibly
NP-complete