|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 6144 (0x1800) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Primary, seg_032e1c
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« └─⟦this⟧
with Scanner; with Object; with Symbols; with Value, Block; with Class_Integer, Class_String, Class_Block; with Bounded_String; package body Primary is type Node_Structure is record Rule : Natural range 0 .. 4 := 0; Obj : Object.Reference := Object.Void_Reference; Ident : Object.Unary; Val : Value.Node := Value.Empty_Node; Blk : Block.Node := Block.Empty_Node; end record; procedure Parse (N : in out Node; Error : out Boolean) is Failed : Boolean := False; begin N := new Node_Structure; case Scanner.Get_Token is when Scanner.Integer => N.Rule := 0; N.Obj := Class_Integer.Value (Scanner.Get_Value); Scanner.Next; when Scanner.String => N.Rule := 1; N.Obj := Class_String.Create (Scanner.Get_Value); Scanner.Next; when Scanner.Identifier => N.Rule := 2; Object.Put (Scanner.Get_Value, N.Ident); Scanner.Next; when Scanner.Special => N.Rule := 3; if Bounded_String.Image (Scanner.Get_Value) = "(" then Scanner.Next; Value.Parse (N.Val, Failed); if not Failed and then Bounded_String.Image (Scanner.Get_Value) = ")" then Scanner.Next; end if; else N.Rule := 4; Block.Parse (N.Blk, Failed); N.Obj := Class_Block.Create (Node => N.Blk); end if; when others => null; end case; Error := Failed; end Parse; function Is_First (T : Scanner.Token) return Boolean is use Scanner; begin return T = Scanner.Integer or else T = Scanner.String or else T = Scanner.Identifier or else T = Scanner.Special or else Block.Is_First (T); end Is_First; function Interpret (N : Node) return Object.Reference is Result : Object.Reference := Object.Void_Reference; Success : Boolean := False; Block_Node : Block.Node := N.Blk; begin case N.Rule is when 0 => Result := N.Obj; when 1 => Result := N.Obj; when 2 => while not Block.Is_Nil (Block_Node) and not Success loop Symbols.Get (Object_Named => Object.Get (N.Ident), From => Block.Get_Table (Block_Node), Into => Result, Status => Success); if not Success then Block_Node := Block.Get_Parent (Block_Node); end if; end loop; when 3 => Result := Value.Interpret (N.Val); when 4 => Result := N.Obj; end case; return Result; end Interpret; end Primary;
nblk1=5 nid=2 hdr6=8 [0x00] rec0=20 rec1=00 rec2=01 rec3=032 [0x01] rec0=1c rec1=00 rec2=04 rec3=00a [0x02] rec0=16 rec1=00 rec2=05 rec3=06a [0x03] rec0=0b rec1=00 rec2=03 rec3=000 [0x04] rec0=0c rec1=00 rec2=03 rec3=000 tail 0x2172e6ec484cc6ad17f83 0x42a00088462060003 Free Block Chain: 0x2: 0000 00 00 03 fb 80 04 75 65 29 3b 04 00 21 20 20 20 ┆ ue); ! ┆