Commit 1d6b9ae4 authored by dcw's avatar dcw

added @@ test code..

also reformatted types
parent cf8b7bc8
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 {
/* not a lot to say here... */
@@
int length( l ) intlist l;
{
int len = 0;
int hd;
while( l != intlist_nil() )
{
get_intlist_cons( l, &hd, &l );
len++;
}
return len;
} /* length */
}
TYPE {
first = a | b | c | d | e;
......@@ -7,8 +49,15 @@ 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 = null "null" | cons( int first, intlist next ) 1 " , " 2;
illist = null "null" | cons( intlist first, illist next ) "[ " 1 " ] , " 2;
idtree = leaf( string id, intlist l ) "leaf( '" 1 "', " 2 ")"
| node( idtree left, idtree right ) "( " 1 " , " 2 " )";
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 " )"
;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment