DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦1b8574a23⟧ Ada Source

    Length: 8192 (0x2000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Expression, seg_037e0e

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦this⟧ 

E3 Source Code



with Block_Class;
with Bounded_String;
with Custom;
with Errors;
with Symbols;
with Trace;
with Unparser;
with Value;

package body Expression is

    type Node_Structure is
        record
            Line : Natural;
            Rule : Natural range 1 .. 2;
            Ident : Scanner.Lexeme;
            Val : Value.Node := Value.Empty_Node;
        end record;

    procedure Parse (N : in out Node) is
    begin
        Trace.Display ("parsing Expression");
        N := new Node_Structure;
        N.Line := Scanner.Get_Line_Number;
        if Value.Is_First (Scanner.Get_Token) then
            N.Rule := 1;
            Value.Parse (N.Val);
        else
            case Scanner.Get_Token is
                when Scanner.L_Pour =>
                    Scanner.Next_Token;
                    case Scanner.Get_Token is
                        when Scanner.L_Id =>
                            N.Rule := 2;
                            N.Ident := Scanner.Get_Value;
                            Scanner.Next_Token;
                            case Scanner.Get_Token is
                                when Scanner.L_Pren =>
                                    Scanner.Next_Token;
                                    if Value.Is_First (Scanner.Get_Token) then
                                        if not Custom.Is_Predefined_Id
                                                  (Bounded_String.Image
                                                      (N.Ident)) then
                                            if not Block_Class.
                                                   Table_Created then
                Block_Class.New_Symbols_Table;  
                                            end if;
                                            Block_Class.Init_Symbol (N.Ident);
                                        end if;
                                        Value.Parse (N.Val);
                                    else
                                        raise Errors.
                                                 Expecting_Value_After_Prendre;
                                    end if;
                                when others =>
                                    raise Errors.Expecting_Prendre_After_Id;
                            end case;
                        when others =>
                            raise Errors.Expecting_Id_After_Pour;
                    end case;
                when others =>
                    raise Errors.Expecting_Pour_Or_Value;
            end case;
        end if;
    end Parse;

    procedure Unparse (N : Node) is
    begin
        case N.Rule is
            when 1 =>
                Value.Unparse (N.Val);
            when 2 =>
                Unparser.Put ("Pour ");
                Unparser.Put (N.Ident);
                Unparser.Put (" prendre ");
                Value.Unparse (N.Val);
        end case;
        Trace.Display ("fin unparse Expression");
    end Unparse;

    function Is_First (T : Scanner.Token) return Boolean is
        use Scanner;
    begin
        return T = Scanner.L_Pour or else Value.Is_First (T);
    end Is_First;

    function Interpret (N : Node) return Object.Reference is
        Result : Object.Reference;
    begin
        Errors.Save_Interpret_Line (N.Line);
        case N.Rule is
            when 1 =>
                Result := Value.Interpret (N.Val);
            when 2 =>
                if not Custom.Is_Predefined_Id
                          (Bounded_String.Image (N.Ident)) then
                    Result := Value.Interpret (N.Val);
                    Block_Class.Set_Value (N.Ident, Result);
                else
                    raise Errors.Affectation_To_Predefined_Id;
                end if;
        end case;
        Trace.Display ("fin interpretation Expression");
        Trace.Display (Result);
        return Result;
    end Interpret;

end Expression;



E3 Meta Data

    nblk1=7
    nid=3
    hdr6=a
        [0x00] rec0=24 rec1=00 rec2=01 rec3=04a
        [0x01] rec0=10 rec1=00 rec2=06 rec3=048
        [0x02] rec0=1b rec1=00 rec2=02 rec3=00e
        [0x03] rec0=1b rec1=00 rec2=04 rec3=026
        [0x04] rec0=06 rec1=00 rec2=07 rec3=000
        [0x05] rec0=08 rec1=00 rec2=03 rec3=001
        [0x06] rec0=32 rec1=44 rec2=00 rec3=01f
    tail 0x21531323084e58e22ac2f 0x42a00088462060003
Free Block Chain:
  0x3: 0000  00 05 00 06 80 03 74 20 3a 03 20 20 4e 2e 49 64  ┆      t :   N.Id┆
  0x5: 0000  00 00 00 90 80 15 65 74 61 74 69 6f 6e 20 45 78  ┆      etation Ex┆