|
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 - metrics - download
Length: 14336 (0x3800) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Instructions, seg_047986
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─⟦cfc2e13cd⟧ »Space Info Vol 2« └─⟦this⟧
with Lex, Error, Token_Pkg, Element, Exprs, Donnee, Set_Of_Token, Element_Global, Element, Liste_Instructions, Enum, Feuille, Bounded_String, String_Table, String_Utilities, Text_Io; use Token_Pkg; package body Instructions is ------------------------------------------------------------------------ -- <UNIT> Instructions ------------------------------------------------------------------------ -- -- <DESCRIPTION> This package defines an operation for parsing the -- grammatical expresssion : <Instructions> -- -- <AUTHOR> Barthe Raphael, Beck Didier, Kempe Laurent -- <VERSION> 1.0 -- <DATE> 16-Jan-95 -- <MODIFY> 16-Jan-95 -- -- <PKG USED> LEX, Token_Pkg, Error, -- ------------------------------------------------------------------------ Unit_Donnee : Set_Of_Token.Object := Set_Of_Token.Make ((T_Vrai, T_Faux, T_Ident, T_String, T_Peut, T_Integer)); Unit_Element_Global : Set_Of_Token.Object := Set_Of_Token.Make ((T_Objet, T_Pnj, T_Hero, T_Direction, T_Piece_Courante)); Unit_Element : Set_Of_Token.Object := Set_Of_Token.Make ((T_Ident, T_Le)); procedure Parse (Tmptree : in out Feuille.Pcell; Success : in out Boolean) is ------------------------------------------------------------------------ -- <SUBPROGRAM> -- <UNIT> Parse -- -- <DESCRIPTION> Try to parse <Instructions> and return if it was a -- success or not. -- -- <EXCEPTIONS> Nothing -- ------------------------------------------------------------------------ Ok : Boolean := True; Astring : String_Table.I_String; Tmpident : String_Table.I_String; Tmptree2, Tmptree3 : Feuille.Pcell; Tmpinstlist : Feuille.Liste_Instr.List; begin case Lex.Gettoken is when T_Si => Lex.Next; Tmptree2 := Feuille.Create (Feuille.Unk); Exprs.Parse (Tmptree2, Ok); Success := Success and Ok; if Lex.Currenttoken_Is (T_Alors) then Tmptree := Feuille.Create (Feuille.Alors); Tmptree.Left := Tmptree2; Lex.Next; Tmptree3 := Feuille.Create (Feuille.Unk); Liste_Instructions.Parse (Tmpinstlist, Ok); Tmptree3 := Feuille.Create (Feuille.Instruction, Tmpinstlist); Tmptree.Right := Tmptree3; Success := Success and Ok; if Lex.Currenttoken_Is (T_Fin_Si) then Lex.Next; else Success := False; Error.Append; end if; else Success := False; Error.Append; end if; when T_Jeu_Termine => Tmptree := Feuille.Create (Feuille.Termine); Lex.Next; when T_Dire => Tmptree := Feuille.Create (Feuille.Dire); Lex.Next; case Lex.Gettoken is when T_String => Bounded_String.Copy (Astring, Lex.Image); Tmptree.Right := Feuille.Create (Feuille.Chaine, Astring); Lex.Next; when T_Ident => Bounded_String.Copy (Tmpident, String_Utilities.Upper_Case (Lex.Image)); --Lex.Next; Element.Parse (Ok); Success := Success and Ok; Tmptree.Right := Element.Tmptree; when others => Success := False; Error.Append; end case; when T_Piece_Courante => Tmptree2 := Feuille.Create (Feuille.Piece_Courante); Lex.Next; if Lex.Currenttoken_Is (T_Vaut) then Tmptree := Feuille.Create (Feuille.Vaut); Element.Parse (Ok); Success := Success and Ok; Tmptree.Left := Tmptree2; Tmptree.Right := Element.Tmptree; else Success := False; Error.Append; end if; when T_Ident | T_Le => Element.Parse (Ok); Success := Success and Ok; case Lex.Gettoken is when T_Vaut => Tmptree := Feuille.Create (Feuille.Vaut); Tmptree.Left := Element.Tmptree; Lex.Next; if Set_Of_Token.Is_Member (Lex.Gettoken, Unit_Element_Global) then Element_Global.Parse (Ok); Success := Success and Ok; Tmptree.Right := Element_Global.Tmptree; elsif Set_Of_Token.Is_Member (Lex.Gettoken, Unit_Donnee) then Donnee.Parse (Ok); Success := Success and Ok; Tmptree.Right := Donnee.Tmptree; else Success := False; Error.Append; end if; when T_Add => Tmptree := Feuille.Create (Feuille.Vaut); Tmptree.Left := Element.Tmptree; Lex.Next; if Lex.Currenttoken_Is (T_Integer) then Tmptree2 := Feuille.Create (Feuille.Plus); Tmptree2.Left := Element.Tmptree; Tmptree3 := Feuille.Create (Feuille.Entier, Natural'Value (Lex.Image)); Tmptree2.Right := Tmptree3; Tmptree.Right := Tmptree2; Lex.Next; else Success := False; Error.Append; end if; when T_Sub => Tmptree := Feuille.Create (Feuille.Vaut); Tmptree.Left := Element.Tmptree; Lex.Next; if Lex.Currenttoken_Is (T_Integer) then Tmptree2 := Feuille.Create (Feuille.Moins); Tmptree2.Left := Element.Tmptree; Tmptree3 := Feuille.Create (Feuille.Entier, Natural'Value (Lex.Image)); Tmptree2.Right := Tmptree3; Tmptree.Right := Tmptree2; Lex.Next; else Success := False; Error.Append; end if; when T_Mul => Tmptree := Feuille.Create (Feuille.Vaut); Tmptree.Left := Element.Tmptree; Lex.Next; if Lex.Currenttoken_Is (T_Integer) then Tmptree2 := Feuille.Create (Feuille.Fois); Tmptree2.Left := Element.Tmptree; Tmptree3 := Feuille.Create (Feuille.Entier, Natural'Value (Lex.Image)); Tmptree2.Right := Tmptree3; Tmptree.Right := Tmptree2; Lex.Next; else Success := False; Error.Append; end if; when T_Div => Tmptree := Feuille.Create (Feuille.Vaut); Tmptree.Left := Element.Tmptree; Lex.Next; if Lex.Currenttoken_Is (T_Integer) then Tmptree2 := Feuille.Create (Feuille.Div); Tmptree2.Left := Element.Tmptree; Tmptree3 := Feuille.Create (Feuille.Entier, Natural'Value (Lex.Image)); Tmptree2.Right := Tmptree3; Tmptree.Right := Tmptree2; Lex.Next; else Success := False; Error.Append; end if; when others => Success := False; Error.Append; end case; when others => Success := False; Error.Append; end case; end Parse; end Instructions;
nblk1=d nid=0 hdr6=1a [0x00] rec0=19 rec1=00 rec2=01 rec3=06e [0x01] rec0=1c rec1=00 rec2=0c rec3=02c [0x02] rec0=01 rec1=00 rec2=0b rec3=060 [0x03] rec0=16 rec1=00 rec2=0a rec3=02e [0x04] rec0=17 rec1=00 rec2=05 rec3=01a [0x05] rec0=19 rec1=00 rec2=04 rec3=024 [0x06] rec0=09 rec1=00 rec2=0d rec3=056 [0x07] rec0=14 rec1=00 rec2=08 rec3=016 [0x08] rec0=00 rec1=00 rec2=07 rec3=022 [0x09] rec0=14 rec1=00 rec2=06 rec3=026 [0x0a] rec0=12 rec1=00 rec2=03 rec3=070 [0x0b] rec0=17 rec1=00 rec2=09 rec3=010 [0x0c] rec0=04 rec1=00 rec2=02 rec3=001 tail 0x2174b2f30865477840398 0x42a00088462060003