Purity checking for reference attribute grammars

Mikael Johnsson · Lund University Publications Student Papers (Lund University) · 2017

JastAdd is a meta compilation tool.It supports Reference Attribute Grammars (RAGs) and other declarative features for easy computation of abstract syntax tree properties in compilers.The attributes values are computed automatically on demand, and are defined by relations, called equations.JastAdd provides caching and optionally parallel evaluation for evaluation of attributes.The control flow is managed by JastAdd and thus not specified by the programmer.Therefore, the result must be invariant of exact order of execution.This requires that the equations are without side effects, i.e., pure otherwise unexpected behaviour might occur.This is not checked by JastAdd and upto the programmer to guarantee.For large programs keeping the code side effect free can be hard and side effect might find their way into the code and may cause subtle errors under specific situations.I explored the possibility to use existing purity checkers for JastAdd.However, no existing tool was directly applicable, and I have therefore implemented a prototype purity checking tool for JastAdd and Java programs.The solution is then tested on several programs and the performance evaluated.

Read the paper · More papers on PaperTik