class List
	begin
		int value;  
		^List next;
	end

^List new( int value; ^List next; )
	begin
		^List node = nodeHeap[ freeNode++ ];
		node.value = value;
		node.next = next;
		return node;
	end

^char endText( ^char s; )
	begin
		while s^ != 0
		do
			s++;
		end
		return s;
	end
	
void buildListText( ^List a; ^char result; )
	begin
		if a != null then
			sprintf( endText( result ), "%d", a.value );
			if a.next != null then
				sprintf( endText( result ), "%s", ", " );
				buildListText( a.next, result );
			end
		end
	end

int freeNode = 0;
[ 20 ]List nodeHeap;

^List a5 = new( 5, null );
^List a3 = new( 3, a5 );
^List a1 = new( 1, a3 );
^List a = a1;

[ 20 ]char result;
sprintf( result, "{ " );
buildListText( a, result );
sprintf( endText( result ), " }" );
printf( "%s\n", result );
