Commit 43ebd2b3 authored by Duncan White's avatar Duncan White

removed some more m2datadec leftovers

parent 69792c72
This diff is collapsed.
EXPORT {
TYPE
string = ARRAY [ 0..200 ] OF CHAR;
@@
PROCEDURE AppendIntList( a, b : IntList ) : IntList;
}
GLOBAL {
FROM BIO IMPORT PutLn;
@@
PROCEDURE AppendIntList( a, b : IntList ) : IntList;
BEGIN
END AppendIntList;
}
BEGIN {
PutLn( "initialization of m2data complete!" );
}
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 ) "node( " 1 " , " 2 " )";
}
MODULE mtest;
(* Test of various automatically generated datatypes *)
FROM BIO IMPORT PutString, PutLine, PutLn;
FROM FIO IMPORT StdOut;
FROM mx IMPORT
IntList, IntListNil, IntListCons, WriteIntList,
ILList, ILListNil, ILListCons, WriteILList,
IdTree, IdTreeLeaf, IdTreeNode, WriteIdTree;
VAR
int1, int2, int3 : IntList;
PROCEDURE testintlist();
BEGIN
int1 := IntListNil();
int2 := IntListCons( 10, int1 );
int3 := IntListCons( 20, int2 );
PutLn( "intlists:" ); PutLine();
PutString( " int1: " ); WriteIntList( StdOut, int1 ); PutLine();
PutString( " int2: " ); WriteIntList( StdOut, int2 ); PutLine();
PutString( " int3: " ); WriteIntList( StdOut, int3 ); PutLine();
PutLine();
END testintlist;
PROCEDURE testillist();
VAR
il1, il2, il3, il4 : ILList;
BEGIN
il1 := ILListNil();
il2 := ILListCons( int1, il1 );
il3 := ILListCons( int2, il2 );
il4 := ILListCons( int3, il3 );
PutLn( "illists:" ); PutLine();
PutString( " il1: " ); WriteILList( StdOut, il1 ); PutLine();
PutString( " il2: " ); WriteILList( StdOut, il2 ); PutLine();
PutString( " il3: " ); WriteILList( StdOut, il3 ); PutLine();
PutString( " il4: " ); WriteILList( StdOut, il4 ); PutLine();
PutLine();
END testillist;
PROCEDURE testidtree();
VAR
id1, id2, id3, id4, id5, id6 : IdTree;
BEGIN
id1 := IdTreeLeaf( "hello", int1 );
id2 := IdTreeLeaf( "there", int2 );
id3 := IdTreeNode( id1, id2 );
id4 := IdTreeNode( id3, id1 );
id5 := IdTreeLeaf( "zebedee", int3 );
id6 := IdTreeNode( id4, id5 );
PutLn( "idtrees:" ); PutLine();
PutString( " id1: " ); WriteIdTree( StdOut, id1 ); PutLine();
PutString( " id2: " ); WriteIdTree( StdOut, id2 ); PutLine();
PutString( " id3: " ); WriteIdTree( StdOut, id3 ); PutLine();
PutString( " id4: " ); WriteIdTree( StdOut, id4 ); PutLine();
PutString( " id5: " ); WriteIdTree( StdOut, id5 ); PutLine();
PutString( " id6: " ); WriteIdTree( StdOut, id6 ); PutLine();
PutLine();
END testidtree;
BEGIN
testintlist();
testillist();
testidtree();
END mtest.
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