Sample App

PROGRAM ParserTreeTest;
USES OPCrt,ParsTree;
VAR Q:PRPtr;
Z:CodeTyp;
Y:LONGINT;
BEGIN
clrscr;
Q:=NIL;
Y:=MemAvail;
IF not (Learn(Q,'BAAB',5)) THEN Writeln('!');
IF not (Learn(Q,'AAAC',3)) THEN Writeln('!');
IF not (Learn(Q,'BAAC',6)) THEN Writeln('!');
IF not (Learn(Q,'CAAD',8)) THEN Writeln('!');
IF not (Learn(Q,'AAAB',2)) THEN Writeln('!');
IF not (Learn(Q,'AAAA',1)) THEN Writeln('!');
IF not (Learn(Q,'BAAD',7)) THEN Writeln('!');
IF not (Learn(Q,'ABAA',4)) THEN Writeln('!');
IF not (Learn(Q,'XAAB',13)) THEN Writeln('!');
IF not (Learn(Q,'XAAC',11)) THEN Writeln('!');
IF not (Learn(Q,'XAAC',14)) THEN Writeln('!');
IF not (Learn(Q,'XAAD',16)) THEN Writeln('!');
IF not (Learn(Q,'XAAB',10)) THEN Writeln('!');
IF not (Learn(Q,'XAAA',9)) THEN Writeln('!');
IF not (Learn(Q,'XAAD',15)) THEN Writeln('!');
IF not (Learn(Q,'XBAA',12)) THEN Writeln('!');
list(Q);
IF Search(Q,'ABAA',Z) THEN Writeln('Found ',Z);
Kill(Q);
Writeln('deltaheap :',Y-MemAvail);
END.

Another sample App

program parsertest;
USES OPCrt,ParsTree,ParserTree;
VAR U:ParserType;
Z:CodeTyp;
Y:LONGINT;
A,B,C,D:LONGINT;
BEGIN
ClrScr;
Y:=Memavail;
U.Init;
IF Not U.Learn('PROGRAM',1) THEN Writeln('!');
IF Not U.Learn('PROCEDURE',1) THEN Writeln('!');
IF Not U.Learn('FUNCTION',1) THEN Writeln('!');
IF Not U.Learn('BEGIN',1) THEN Writeln('!');
IF Not U.Learn('END',1) THEN Writeln('!');
IF Not U.Learn('FOR',1) THEN Writeln('!');
IF Not U.Learn('WHILE',1) THEN Writeln('!');
IF Not U.Learn('REPEAT',1) THEN Writeln('!');
IF Not U.Learn('IF',1) THEN Writeln('!');
IF Not U.Learn('TYPE',1) THEN Writeln('!');
IF Not U.Learn('CONST',1) THEN Writeln('!');
IF Not U.Learn('VAR',1) THEN Writeln('!');
IF Not U.Learn('UNTIL',1) THEN Writeln('!');
U.List;
U.Size(A,B,C,D);
IF U.Search('ZETA',Z) THEN Writeln('Found ',Z);
U.Done;
Writeln('DeltaHeap :',Y-Memavail);
END.