|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: B T
Length: 1850 (0x73a)
Types: TextFile
Names: »B«
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
└─⟦129cab021⟧ »DATA«
└─⟦this⟧
with Stack_Generic;
with Lexical;
use Lexical;
with Erreurs;
separate (Semantique)
package body Calcul is
subtype Facteur is Integer;
type Ptr_Facteur is access Facteur;
type Operateur is ('(', '+', '-', '*', 'p', 'm', ')', Finop);
package Es_Op is new Text_Io.Enumeration_Io (Operateur);
use Es_Op;
type Elt (Isfact : Boolean) is
record
case Isfact is
when False =>
Op : Operateur;
when True =>
Fact : Ptr_Facteur;
end case;
end record;
type Ptr_Elt is access Elt;
Var_Undef : exception;
package Pilfact is new Stack_Generic (Ptr_Facteur);
Pile : Pilfact.Stack;
package Piloper is new Stack_Generic (Operateur);
Pilop : Piloper.Stack;
Par_Ferm, Err_Op : exception;
Precoper : Boolean := True;
Op_Inconnu : Character;
procedure Getval (Nb : out Integer) is
F : Ptr_Facteur;
begin
F := Pilfact.Top (Pile);
Pilfact.Pop (Pile);
Nb := F.all;
end Getval;
function Lirelem (Un_Token : Lexical.Token; Une_Valeur : Integer)
return Ptr_Elt is separate;
procedure Demarre_Calcul is
begin
Pilfact.Make_Empty (Pile);
Piloper.Make_Empty (Pilop);
Piloper.Push (Finop, Pilop);
end Demarre_Calcul;
procedure Calculateur (Un_Elem : Ptr_Elt) is separate;
procedure Postfixer (Un_Elem : Ptr_Elt) is separate;
procedure Empiler (Un_Jeton : Lexical.Token; Une_Valeur : Integer := 0) is
begin
Postfixer (Lirelem (Un_Jeton, Une_Valeur));
end Empiler;
procedure Evaluer_Expression (La_Valeur : out Integer) is
begin
La_Valeur := Pilfact.Top (Pile).all;
Pilfact.Pop (Pile);
end Evaluer_Expression;
end Calcul;