Download View/Open - Calhoun: The NPS

Transcript
(* until delimeter or eoln *)
read(ch);
ndx
:=
1;
(* while*)
end;
end;
ndx +
(* if *)
(*
read(ch); read(ch);
end;
(*
remove
rest of
arrow
*)
ReadOperMet*)
*)
('
function OpSearch (Head: OperPtr;
Target: stringSO): OperPtr;
(* Searches Operator List for Target string, returns pointer *)
(* to target
if
found, otherwise
NIL
*)
begin
Head = nil then
OpSearch := nil
if
(*
else if Head^.OpName = Target then
OpSearch := Head
empty
(* target
list
*)
found
*)
else
OpSearch
end;
/*
OpSearch(Head^.Link, Target);
:=
_
Op Add
procedure
*\
_
(var Head: OperPtr;
varTail: Op>erPtr;
Target: stringSO);
(*
Adds new Operator
to
end of linked
list
*)
var
p: OperPtr;
(*
temp pointer
*)
empty
*)
begin
if
Head =
nil
then
(* List
is
begin
new(p);
(* Create
new head node
*)
Head
:= p;
Tail := p;
p^.OpName
:= Target;
p^.InputList :=
list
*)
nil;
p'^.OutputList :=
nil;
p^.OutListTail :=
p^.Link :=
new
nil;
p^.InListTail :=
end (*
(* Initialize
nil;
nil;
if *)
(* List not
else
empty
*)
begin
new(p);
(*
Tail'^.Link := p;
64
Add new node
after tail *)