2021-12-08 15:43:33 +00:00
|
|
|
with Ada.Finalization;
|
2021-12-05 16:13:36 +00:00
|
|
|
|
|
|
|
package H3.Trees is
|
|
|
|
|
|
|
|
--package A is new H3.Arrays(XXXX, 0);
|
|
|
|
|
|
|
|
type Node_Code is (
|
|
|
|
NODE_ASSIGN,
|
|
|
|
NODE_CALL,
|
2021-12-08 15:43:33 +00:00
|
|
|
NODE_CLASS,
|
2021-12-05 16:13:36 +00:00
|
|
|
NODE_IF,
|
|
|
|
NODE_FUN,
|
|
|
|
NODE_VOID,
|
|
|
|
NODE_WHILE
|
|
|
|
);
|
|
|
|
|
2021-12-08 15:43:33 +00:00
|
|
|
type Node;
|
|
|
|
type Node_Pointer is access Node;
|
|
|
|
|
2021-12-05 16:13:36 +00:00
|
|
|
type Node(Code: Node_Code := NODE_VOID) is record
|
|
|
|
-- Loc: location.
|
2021-12-08 15:43:33 +00:00
|
|
|
Next: Node_Pointer;
|
2021-12-05 16:13:36 +00:00
|
|
|
case Code is
|
|
|
|
when NODE_ASSIGN =>
|
|
|
|
null;
|
|
|
|
when NODE_CALL =>
|
|
|
|
null;
|
|
|
|
when NODE_CLASS =>
|
|
|
|
null;
|
|
|
|
when NODE_IF =>
|
|
|
|
null;
|
|
|
|
when NODE_FUN =>
|
|
|
|
null;
|
|
|
|
when NODE_VOID =>
|
|
|
|
null;
|
|
|
|
when NODE_WHILE =>
|
|
|
|
null;
|
2021-12-08 15:43:33 +00:00
|
|
|
end case;
|
2021-12-05 16:13:36 +00:00
|
|
|
end record;
|
|
|
|
|
2021-12-08 15:43:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
-- parse tree
|
|
|
|
type Tree is new Ada.Finalization.Limited_Controlled with record
|
|
|
|
--Next_Node: System_Index := System_Index'First;
|
|
|
|
--Toplevel_Node := Node;
|
|
|
|
Top: Node_Pointer := null;
|
|
|
|
end record;
|
2021-12-05 16:13:36 +00:00
|
|
|
|
2021-12-08 15:43:33 +00:00
|
|
|
overriding procedure Initialize (C: in out Tree);
|
|
|
|
overriding procedure Finalize (C: in out Tree);
|
2021-12-05 16:13:36 +00:00
|
|
|
end H3.Trees;
|