Origin Tracking in Attribute Grammars

  • Kevin Williams
  • Eric Van Wyk
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8706)


Origin tracking is a technique for relating the output of a transformation back to its input. In term rewriting systems, where this notion was developed, it relates subtrees in the resulting normal form term to the original term. The technique is useful in several settings, including program debugging and error reporting.

We show how origin tracking can be integrated into higher-order attribute grammars, which construct new syntax trees during attribute evaluation. Furthermore, we extend origins with additional information to track sub trees that correspond to the redex and contractum of rewrite rules when implemented using attribute grammars. The computation of origins and their extensions is formally defined using big-step operational semantics. Finally we describe a program transformation framework as an example use of origin tracking in attribute grammars.


Local Attribute Attribute Equation Evaluation Rule Input Tree Syntax Tree 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Borras, P., Clement, D., Despeyroux, T., Incerpi, J., Kahn, G., Lang, B., Pascual, V.: Centaur: The system. SIGPLAN Not 24(2), 14–24 (1988)CrossRefGoogle Scholar
  2. 2.
    Boyland, J.T.: Remote attribute grammars. J. ACM 52(4), 627–687 (2005)CrossRefMathSciNetGoogle Scholar
  3. 3.
    Courcelle, B., Franchi-Zannettacci, P.: Attribute grammars and recursive program schemes I and II. Theoretical Computer Science 17(2), 163–191, 235–257 (1982)Google Scholar
  4. 4.
    van Deursen, A.: Origin tracking in primitive recursive schemes. In: Conf. Proc. Computing Science in the Netherlands. pp. 132–143, available as technical report CS-R9401. Centrum voor Wiskunde en Informatica, Amsterdam, The Netherlands (1993)Google Scholar
  5. 5.
    van Deursen, A., Klint, P., Tip, F.: Origin tracking. Journal of Symbolic Computation 15, 523–545 (1992)CrossRefGoogle Scholar
  6. 6.
    Hedin, G.: Reference attribute grammars. Informatica 24(3), 301–317 (2000)zbMATHGoogle Scholar
  7. 7.
    Ikezoe, Y., Sasaki, A., Ohshima, Y., Wakita, K., Sassa, M.: Systematic debugging of attribute grammars. In: Proc. 4th Int. Workshop on Automated Debugging, pp. 235–240 (2000)Google Scholar
  8. 8.
    Kats, L.C.L., Visser, E.: The Spoofax language workbench. Rules for declarative specification of languages and IDEs. In: Proc. of ACM Conf. on Object Oriented Programming, Systems, Languages, and Systems (OOPSLA). ACM (2010)Google Scholar
  9. 9.
    Klint, P., van der Storm, T., Vinju, J.: Rascal: a domain specific language for source code analysis and manipulation. In: Proc. of Source Code Analysis and Manipulation, SCAM 2009 (2009)Google Scholar
  10. 10.
    Knuth, D.E.: Semantics of context-free languages. Mathematical Systems Theory 2(2), 127–145 (1968), corrections in 5 (1971)Google Scholar
  11. 11.
    Martins, P., Saraiva, J., Fernandes, J.P., Van Wyk, E.: Generating attribute grammar-based bidirectional transformations from rewrite rules. In: Proc. of the ACM SIGPLAN 2014 Workshop on Partial Evaluation and Program Manipulation (PEPM), pp. 63–70. ACM (2014)Google Scholar
  12. 12.
    Ragan-Kelley, J., Barnes, C., Adams, A., Paris, S., Durand, F., Amarasinghe, S.: Halide: A language and compiler for optimizing parallelism, locality, and recomputation in image processing pipelines. In: Proc. of ACM Conf. on Programming Language Design and Implementation (PLDI), pp. 519–530. ACM (2013)Google Scholar
  13. 13.
    Van Wyk, E., Bodin, D., Gao, J., Krishnan, L.: Silver: an extensible attribute grammar system. Science of Computer Programming 75(1–2), 39–54 (2010)zbMATHMathSciNetGoogle Scholar
  14. 14.
    Vogt, H., Swierstra, S.D., Kuiper, M.F.: Higher-order attribute grammars. In: Proc. of ACM Conf. on Programming Language Design and Implementation (PLDI), pp. 131–145. ACM (1989)Google Scholar
  15. 15.
    Williams, K., Le, M., Kaminski, T., Van Wyk, E.: A compiler extension for parallel matrix programming. In: Proc. of the International Conf. on Parallel Programming (ICPP) (September 2014)Google Scholar

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  • Kevin Williams
    • 1
  • Eric Van Wyk
    • 1
  1. 1.Department of Computer Science and EngineeringUniversity of MinnesotaMinneapolisUSA

Personalised recommendations