Table of Contents
Fetching ...

Tahr: The Generative Attribute Grammar Framework

Matteo Ciccaglione, Pierciro Caliandro, Alessandro Pellegrini

TL;DR

The paper presents Tahr, a modular framework that ingests extended attribute grammar specifications to automatically generate parsing, generation, and translation artefacts. It supports stochastic resolution of ambiguity and explicit translational rules to map between grammars, enabling cross-language text manipulation and IP-protective transformations. The authors validate Tahr on non-trivial translations, translating MiBench MIPS programs to x86 and VMorph targets with semantically equivalent outputs. Open-source release and a dedicated algorithmic workbench position Tahr as a practical tool for researchers exploring attribute grammars and their translational capabilities.

Abstract

In this article, we present Tahr, a framework that allows taking attribute grammar specifications and generating a set of software artefacts that can be used programmatically to operate on text compliant with the grammars. Tahr can be used as an algorithmic workbench to test different manipulations of attribute grammars and support translation between different languages out of the box. We describe the framework's organisation, how the user can specify an attribute grammar, and the generated software artefacts. We also discuss how Tahr deals with ambiguous grammar specifications, and how this ambiguity can be effectively exploited when using attribute grammars for text generation. We test the correctness of Tahr by showing the practical possibility of translating MIPS programs into their corresponding equivalents for x86 architectures and a custom virtual machine.

Tahr: The Generative Attribute Grammar Framework

TL;DR

The paper presents Tahr, a modular framework that ingests extended attribute grammar specifications to automatically generate parsing, generation, and translation artefacts. It supports stochastic resolution of ambiguity and explicit translational rules to map between grammars, enabling cross-language text manipulation and IP-protective transformations. The authors validate Tahr on non-trivial translations, translating MiBench MIPS programs to x86 and VMorph targets with semantically equivalent outputs. Open-source release and a dedicated algorithmic workbench position Tahr as a practical tool for researchers exploring attribute grammars and their translational capabilities.

Abstract

In this article, we present Tahr, a framework that allows taking attribute grammar specifications and generating a set of software artefacts that can be used programmatically to operate on text compliant with the grammars. Tahr can be used as an algorithmic workbench to test different manipulations of attribute grammars and support translation between different languages out of the box. We describe the framework's organisation, how the user can specify an attribute grammar, and the generated software artefacts. We also discuss how Tahr deals with ambiguous grammar specifications, and how this ambiguity can be effectively exploited when using attribute grammars for text generation. We test the correctness of Tahr by showing the practical possibility of translating MIPS programs into their corresponding equivalents for x86 architectures and a custom virtual machine.

Paper Structure

This paper contains 11 sections, 2 equations, 6 figures, 2 algorithms.

Figures (6)

  • Figure 1: Overall Structure of the Tahr framework.
  • Figure 2: Tahr 3-level extended attribute grammar.
  • Figure 3: The Tahr Framework Organization.
  • Figure 4: Generated rule function example
  • Figure 5: Generated terminal rule function example
  • ...and 1 more figures