Control-Monad-MultiPass-0.1.0.0: A Library for Writing Multi-Pass Algorithms.

Safe HaskellSafe

Control.Monad.MultiPass.Example.CFG

Description

This example is a variation on the assembler example. It illustrates how one might convert a control flow graph into a linear sequence of instructions. The example is less complete than the assembler example, so the output is not real machine code. Instead the output is a simple serialised representation of the control flow graph.

In this example, the control flow graph is represented as a Array, which is an immutable datatype. The example can also be implemented with a mutable representation of the control flow graph, as shown in Control.Monad.MultiPass.Example.CFG2.

Documentation

newtype Node Source

Constructors

Node Int 

Instances

emitCFG :: CFG -> ST2 r w (ST2Array r w Position Int)Source