L2CA Exemples : List Counter


This Program just count the length of the list.

Program Source

pointer i,j;
int a;

j = i;
a = 0;
while !(j == null) do
a = a + 1;
j = j.next;
od

Initial Heap

1 // nb of vertices (this is optional)
O x null (i); // id counterName nextVertice RootList

DOT Output

This is what L2CA generates when used on those program and heap. You can see the shape of the heap through the program execution.

The doted boxes are the automaton states and small ones the heap vertices, in which the first line is for the roots and the second for the counter.
[This is a guard] this is an action ;