PeterBURG: a Generic Back-End Generator

PeterBURG is an implementation of well-known Bottom-Up tree Rewriting System (BURS) generator for rapid codegenerator development. The closiest relatives of PeterBURG are BURG, IBURG and Twig (see Compiler Construction Resources for details).

Since there are already a number of good BURG implementations the main idea of PeterBURG is not BURS as such but rather it functional implementation when all needed descriptions are written in the same source language as PeterBURG itself.

PeterBURG is written in Objective Caml programming language and consists of bundle of modules and functors implementing all BURS facilities.

Source tree to rewrite as well as grammar have to be introduces as modules with appropriate (required by PeterBURG) type. BURS dynamic programming algorithm is then accessible via functor instantiation. So BURS grammar, tree, semantic actions and algorithm itself are ultimately implemented in the same programming language.

In comparison with conventional BURS technique there are some extensions introduced in PeterBURG:

  • arbitrary attribute (not only cost value) can be associated with tree node during labeling stage. So additional information can be taken into account.
  • generic semantic actions can be supplied for every grammar rule not only for labeling but also for reduce stage. These semantic actions can derive attribute value together with nonterminal. So the grammars covered by PeterBURG are in fact attribute.
  • PeterBURG implements not only labeling but also reduce stage of BURS process.
  • These features allow to implement slightly more broad set of algorithms controlled by BURS process. For example it is possible to incorporate Aho-Johnson register allocation principle with instruction selection.

    PeterBURG is available for free without any warranty. One can download, distribute, modify and use it in any other manner without prompting of author. The distribution consists of source files, example and Makefile. Simply look at that stuff to clarify how to make it work.

    More in this section:

  • PeterBURG description - a short description of PeterBURG interface
  • PeterBURG distribution - PeterBURG implementation

  • back

    Copyright © OOPS Team