Linearly Ordered Attribute Grammar Scheduling Using SAT-Solving

Many computations over trees can be specified using attribute grammars. Compilers for attribute grammars need to find an evaluation order or schedule in order to generate efficient code. For the class of linearly ordered attribute grammars such a schedule can be found statically, but this problem is known to be NP-hard. In this paper, we show how to encode linearly ordered attribute grammar scheduling as a SAT-problem. For such grammars it is necessary to ensure that the dependency graph is cycle free, which we approach in a novel way by transforming the dependency graph to a chordal graph allowing the cycle freeness to be efficiently expressed and computed using SAT solvers. There are two main advantages to using a SAT-solver for scheduling: 1 the scheduling algorithm runs faster than existing scheduling algorithms on real-world examples, and 2 by adding extra constraints we obtain fine-grained control over the resulting schedule, thereby enabling new scheduling optimisations.

[1]  Joao Paulo Saraiva,et al.  Purely Functional Implementation of Attribute Grammars , 1999 .

[2]  Ken Kennedy,et al.  Automatic generation of efficient evaluators for attribute grammars , 1976, POPL.

[3]  G. Dirac On rigid circuit graphs , 1961 .

[4]  S. Doaitse Swierstra,et al.  The Kennedy-Warren Algorithm Revisited: Ordering Attribute Grammars , 2012, PADL.

[5]  Uwe Kastens,et al.  Ordered attributed grammars , 1980, Acta Informatica.

[6]  Joost Engelfriet,et al.  Simple Multi-Visit Attribute Grammars , 1982, J. Comput. Syst. Sci..

[7]  João Saraiva,et al.  Designing and Implementing Combinator Languages , 1998, Advanced Functional Programming.

[8]  Daan Leijen,et al.  Helium, for learning Haskell , 2003, Haskell '03.

[9]  M. Sheeran,et al.  SAT-solving in practice , 2008, 2008 9th International Workshop on Discrete Event Systems.

[10]  Donald E. Knuth,et al.  Semantics of context-free languages , 1968, Mathematical systems theory.

[11]  Mary Sheeran,et al.  SAT-Solving in Practice, with a Tutorial Example from Supervisory Control , 2009, Discret. Event Dyn. Syst..

[12]  Arie Middelkoop,et al.  Functional Instrumentation of ActionScript Programs with Asil , 2011, IFL.

[13]  Stephen A. Cook,et al.  The complexity of theorem-proving procedures , 1971, STOC.

[14]  Richard S. Bird Using circular programs to eliminate multiple traversals of data , 2004, Acta Informatica.

[15]  S. Doaitse Swierstra,et al.  The architecture of the Utrecht Haskell compiler , 2009, Haskell.

[16]  Atze Dijkstra,et al.  Linearly Ordered Attribute Grammars: with Automatic Augmenting Dependency Selection , 2015, PEPM.

[17]  Randal E. Bryant,et al.  Boolean satisfiability with transitivity constraints , 2000, TOCL.

[18]  Michael Codish,et al.  Pairwise Cardinality Networks , 2010, LPAR.

[19]  Torbjörn Ekman,et al.  The jastadd extensible java compiler , 2007, OOPSLA.

[20]  Niklas Sörensson,et al.  An Extensible SAT-solver , 2003, SAT.