Results 1 - 10
of
22
Forwarding in attribute grammars for modular language design
- In Proc. 11th Intl. Conf. on Compiler Construction, volume 2304 of LNCS
, 2002
"... Abstract. Forwarding is a technique for providing default attribute definitions in attribute grammars that is helpful in the modular implementation of programming languages. It complements existing techniques such as default copy rules. This paper introduces forwarding, and shows how it is but a sma ..."
Abstract
-
Cited by 54 (17 self)
- Add to MetaCart
Abstract. Forwarding is a technique for providing default attribute definitions in attribute grammars that is helpful in the modular implementation of programming languages. It complements existing techniques such as default copy rules. This paper introduces forwarding, and shows how it is but a small extension of standard higher-order attribute grammars. The usual tools for manipulating higher-order attribute grammars, including the circularity check (which tests for cyclic dependencies between attribute values), carry over without modification. The closure test (which checks that each attribute has a defining equation) needs modification, however, because the resulting higher-order attribute grammars may contain spurious attributes that are never evaluated, and indeed that need not be defined. 1
Aspectoriented compilers. In
- Generative and Component-Based Software Engineering (GPCE
, 1999
"... Abstract Aspect-oriented programming provides the programmer with means to cross-cut conventional program structures, in particular the class hierarchies of object-oriented programming. This paper studies the use of aspect orientation in structuring syntax directed compilers. Syntax-directed compil ..."
Abstract
-
Cited by 29 (2 self)
- Add to MetaCart
(Show Context)
Abstract Aspect-oriented programming provides the programmer with means to cross-cut conventional program structures, in particular the class hierarchies of object-oriented programming. This paper studies the use of aspect orientation in structuring syntax directed compilers. Syntax-directed compilers are often speci ed by means of attribute grammars. Such speci cations are typically structured by production | it is hard to structure them by semantic aspects such as`environment',`lexical level' and type checking'. Even if such structuring is allowed at a syntactic level, it is certainly not possible to parameterise compiler aspects, and to treat them as rst-class objects in the speci cation language. In this paper we propose a technique for making compiler aspects' rst-class objects, that can be stored, manipulated and combined. We propose a modest set of combinators that achieve this task in the functional programming language Haskell. The combinator library is an application of recent work on polymorphic type systems for record operations, in particular that of Gaster and Jones, and also of a technique due to R emy, which types symmetric record concatenation`for free'. It is hoped that this embedding of an aspect-oriented programming style in Haskell provides a stepping stone towards a more general study of the semantics of aspect-oriented programming. 1 Introduction Compilers are often structured by recursion over the abstract syntax of the source language. For each production in the abstract syntax, one de nes a function that speci es how a construct is to be translated. The method of structuring compilers in this syntax{directed manner underlies the formalism of attribute grammars
A Functional Semantics of Attribute Grammars
- In International Conference on Tools and Algorithms for Construction and Analysis of Systems, Lecture Notes in Computer Science
, 2002
"... A definition of the semantics of attribute grammars is given, using the lambda calculus. We show how this semantics allows us to prove results about attribute grammars in a calculational style. In particular, we give a new proof of Chirica and Martin's result [6], that the attribute values can ..."
Abstract
-
Cited by 12 (3 self)
- Add to MetaCart
(Show Context)
A definition of the semantics of attribute grammars is given, using the lambda calculus. We show how this semantics allows us to prove results about attribute grammars in a calculational style. In particular, we give a new proof of Chirica and Martin's result [6], that the attribute values can be computed by a structural recursion over the tree. We also derive a new definedness test, which encompasses the traditional closure and circularity tests. The test is derived by abstract interpretation.
Decorated Attribute Grammars. Attribute Evaluation Meets Strategic Programming
, 2008
"... Attribute grammars are a powerful specification formalism for tree-based computation, particularly for software language processing. Various extensions have been proposed to abstract over common patterns in attribute grammar specifications. These include various forms of copy rules to support non-l ..."
Abstract
-
Cited by 12 (5 self)
- Add to MetaCart
(Show Context)
Attribute grammars are a powerful specification formalism for tree-based computation, particularly for software language processing. Various extensions have been proposed to abstract over common patterns in attribute grammar specifications. These include various forms of copy rules to support non-local dependencies, collection attributes, and expressing dependencies that are evaluated to a fixed point. Rather than implementing extensions natively in an attribute evaluator, we propose attribute decorators that describe an abstract evaluation mechanism for attributes, making it possible to provide such extensions as part of a library of decorators. Inspired by strategic programming, they are specified using generic traversal operators. To demonstrate their effectiveness, we describe how to employ decorators in name, type, and flow analysis.
Attribute grammars fly first-class: how to do aspect oriented programming in Haskell
- in: Proceedings of the International Conference on Functional Programming, ACM, 2009
"... Attribute Grammars (AGs), a general-purpose formalism for de-scribing recursive computations over data types, avoid the trade-off which arises when building software incrementally: should it be easy to add new data types and data type alternatives or to add new operations on existing data types? How ..."
Abstract
-
Cited by 11 (3 self)
- Add to MetaCart
Attribute Grammars (AGs), a general-purpose formalism for de-scribing recursive computations over data types, avoid the trade-off which arises when building software incrementally: should it be easy to add new data types and data type alternatives or to add new operations on existing data types? However, AGs are usually im-plemented as a pre-processor, leaving e.g. type checking to later processing phases and making interactive development, proper er-ror reporting and debugging difficult. Embedding AG into Haskell as a combinator library solves these problems. Previous attempts at embedding AGs as a domain-specific language were based on extensible records and thus exploiting Haskell’s type system to check the well-formedness of the AG, but fell short in compactness and the possibility to abstract over oft oc-curring AG patterns. Other attempts used a very generic mapping for which the AG well-formedness could not be statically checked. We present a typed embedding of AG in Haskell satisfying all these requirements. The key lies in using HList-like typed heteroge-neous collections (extensible polymorphic records) and expressing AG well-formedness conditions as type-level predicates (i.e., type-class constraints). By further type-level programming we can also express common programming patterns, corresponding to the typ-ical use cases of monads such as Reader, Writer and State. The paper presents a realistic example of type-class-based type-level programming in Haskell.
Separation of concerns in translational semantics for dsls in model engineering
- in SAC ’07: Proceedings of the 2007 ACM symposium on Applied computing
"... ..."
(Show Context)
Comonadic functional attribute evaluation
- Trends in Functional Programming
"... We have previously demonstrated that dataflow computation is comonadic. Here we argue that attribute evaluation has a lot in common with dataflow computation and admits a similar analysis. We claim that this yields a new, modular way to organize both attribute evaluation programs written directly in ..."
Abstract
-
Cited by 4 (2 self)
- Add to MetaCart
We have previously demonstrated that dataflow computation is comonadic. Here we argue that attribute evaluation has a lot in common with dataflow computation and admits a similar analysis. We claim that this yields a new, modular way to organize both attribute evaluation programs written directly in a functional language as well as attribute grammar processors.
Zipper-based Attribute Grammars and their Extensions?
"... Abstract. Attribute grammars are a suitable formalism to express com-plex software language analysis and manipulation algorithms, which rely on multiple traversals of the underlying syntax tree. Recently, Attribute Grammars have been extended with mechanisms such as references and high-order and cir ..."
Abstract
-
Cited by 1 (1 self)
- Add to MetaCart
(Show Context)
Abstract. Attribute grammars are a suitable formalism to express com-plex software language analysis and manipulation algorithms, which rely on multiple traversals of the underlying syntax tree. Recently, Attribute Grammars have been extended with mechanisms such as references and high-order and circular attributes. Such extensions provide a powerful modular mechanism and allow the specification of complex fix-point com-putations. This paper defines an elegant and simple, zipper-based embed-ding of attribute grammars and their extensions as first class citizens. In this setting, language specifications are defined as a set of independent, off-the-shelf components that can easily be composed into a powerful, executable language processor. Several real examples of language speci-fication and processing programs have been implemented in this setting. 1
Disentangling Denotational Semantics Definitions
"... Abstract: Denotational semantics is a powerful technique to formally define programming languages. However, language constructs are not always orthogonal, so many semantic equations in a definition may have to be aware of unrelated constructs semantics. Current approaches for modularity in this form ..."
Abstract
-
Cited by 1 (0 self)
- Add to MetaCart
Abstract: Denotational semantics is a powerful technique to formally define programming languages. However, language constructs are not always orthogonal, so many semantic equations in a definition may have to be aware of unrelated constructs semantics. Current approaches for modularity in this formalism do not address this problem, providing, for this reason, tangled semantic definitions. This paper proposes an incremental approach for denotational semantic specifications, in which each step can either add new features or adapt existing equations, by means of a formal language based on function transformation and aspect weaving.
Attribute Grammar Combinators
, 2011
"... Abstract. Having extensible languages is appealing but raises the question of how to construct extensible compilers and how to compose compilers out of a collection of pre-compiled components. Being able to deal with attribute grammar fragments as first-class values makes it possible to describe sem ..."
Abstract
- Add to MetaCart
(Show Context)
Abstract. Having extensible languages is appealing but raises the question of how to construct extensible compilers and how to compose compilers out of a collection of pre-compiled components. Being able to deal with attribute grammar fragments as first-class values makes it possible to describe semantics in a compositional way; this leads naturally to a plug-in architecture, in which a core compiler can be constructed as a (collection of) pre-compiled component(s), and to which extra components can safely be added at will as need arises. We present an Emddded Domain Specific language (EDSL), in the form of a Haskell combinator library, which makes the above possible in a typeful way; both the check for the well-definedness of the constructed attribute grammar and the well-definedness of attribute computations is taken care of by the Haskell type checker. With our combinators it is easy to describe semantics in terms of already existing semantics, just as syntax macros extend language syntax. We also show how existing semantics can be redefined, thus adapting some aspects from the behavior defined by the macros. 1