Program Transformation

From Gallium

Jump to: navigation, search

Program Transformation can be written in a very neat way using concrete syntax instead of abstract syntax trees.

Example giving some rewriting rules:

 << $x$ + 0 >> | << 0 + $x$ >> -> x
 << $x$ * 1 >> | << 1 * $x$ >> -> x
 << $x$ * ($y$ + $z$) >> -> << $x$ * $y$ + $x$ * $z$ >>
 << ($x$ + $y$) * $z$ >> -> << $x$ * $z$ + $y$ * $z$ >>
Personal tools
Espace privé