Pepe's Braindump

Commuting Conversion

tags
compilers, Programming Languages

Consider this code, in a functional language:

if (if e1 then e2 else e3)
   then e4
   else e5

Many compilers will perform acommuting conversion[13],which naively would produce:

if e1
  then (if e2 then e4 else e5)
  else (if e3 then e4 else e5)

Cortex theme by Jethro Kuan. Built with org-mode, org-roam and Hugo