Zipping Strategies and Attribute Grammars

10/15/2021
by   José Nuno Macedo, et al.
0

Strategic term rewriting and attribute grammars are two powerful programming techniques widely used in language engineering. The former, relies on strategies to apply term rewrite rules in defining language transformations, while the latter is suitable to express context-dependent language processing algorithms. Each of these techniques, however, is usually implemented by its own powerful and large language processor system. As a result, it makes such systems harder to extend and to combine. In this paper, we present the embedding of both strategic tree rewriting and attribute grammars in a zipper-based, purely functional setting. Zippers provide a simple, but generic tree-walk mechanism that is the building block technique we use to express the purely-functional embedding of both techniques. The embedding of the two techniques in the same setting has several advantages: First, we easily combine/zip attribute grammars and strategies, thus providing language engineers the best of the two worlds. Second, the combined embedding is easier to maintain and extend since it is written in a concise and uniform setting. This results in a very small library which is able to express advanced (static) analysis and transformation tasks. We show the expressive power of our library in optimizing Haskell let expressions, expressing several Haskell refactorings and solving several language processing tasks of the LDTA Tool Challenge.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
07/04/2018

A Purely Functional Computer Algebra System Embedded in Haskell

We demonstrate how methods in Functional Programming can be used to impl...
research
12/31/2018

Generic Programming in OCaml

We present a library for generic programming in OCaml, adapting some tec...
research
01/18/2022

Lambda the Ultimate SSA: Optimizing Functional Programs in SSA

Static Single Assignment (SSA) is the workhorse of modern optimizing com...
research
08/28/2020

On the Performance of Bytecode Interpreters in Prolog

The semantics and the recursive execution model of Prolog make it very n...
research
06/15/2021

Introducing Type Properties

In type theory, we can express many practical ideas by attributing some ...
research
06/08/2017

Regular Boardgames

We present an initial version of Regular Boardgames general game descrip...

Please sign up or login with your details

Forgot password? Click here to reset