home *** CD-ROM | disk | FTP | other *** search
- {Stack of parse tree nodes}
- unit NodeStack;
-
- interface
- uses
- PrseTree,Classes;
- type TNodeStack=class
- protected
- fBody:TList;
- public
- constructor Create;
- destructor Destroy;override;
- procedure Push(a:PNode);
- function Pop:PNode;
- end;
- implementation
- constructor TNodeStack.Create;
- begin
- fBody:=TList.Create;
- end;
- destructor TNodeStack.Destroy;
- begin
- fBody.Free;
- end;
- procedure TNodeStack.Push;
- begin
- fBody.Add(a);
- end;
- function TNodeStack.Pop;
- begin
- Result:=fBody[fBody.Count-1];
- fBody.Delete(fBody.Count-1);
- end;
-
- end.
-