EXPORT {

/* hello there - welcome to my test file */

/* isn't it fun? */

@@

#ifdef HASPROTOS
extern int length( intlist );
#else
extern int length();
#endif

/* bye now */

}


GLOBAL {

@@

int length( l ) intlist l;
{
	int len = 0;
	int hd;

	while( l != intlist_nil() ) 
	{
		get_intlist_cons( l, &hd, &l );
		len++;
	}
	return len;

} /* length */

}


BEGIN {
	printf( "initialization of cdata complete!\n" );
}


TYPE {

first	= a | b | c | d | e;
second	= a( int aa );
third	= a | b;
fourth	= a | b | c(int cc) | d | e;
fifth	= a | b | c(int cc) | d( string dd) | e;
sixth	= a(int aa) | b | c | d | e;

intlist = nil						"nil"
	| cons( int first, intlist next )		1 " , " 2
	;

illist  = nil						"nil"
	| cons( intlist first, illist next )		"[ " 1 " ] , " 2
	;

idtree  = leaf( string id, intlist l )			"leaf( '" 1 "', " 2 ")"
	| node( idtree left, idtree right )		"( " 1 " , " 2 " )"
	;
}
