|
|
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: 30720 (0x7800)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Syn, seg_03f530
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
with Text_Io, Lex, Error;
use Text_Io, Lex, Error;
package body Syn is
function Instructions_Simples return Boolean;
function Expression return Boolean;
function Type_Base return Boolean is
Ok : Boolean := True;
begin
case Lex.Get_Token is
when Entier | Chaine | Identifier =>
Lex.Next;
when others =>
Ok := False;
Error.Syn (Type_Base, Follow_Type_Base);
end case;
return Ok;
end Type_Base;
function Type_Structure return Boolean is
Ok : Boolean := True;
begin
case Lex.Get_Token is
when Anime | Lieu | Entite | Identifier =>
Lex.Next;
when others =>
Ok := False;
Error.Syn (Type_Structure, Follow_Type_Structure);
end case;
return Ok;
end Type_Structure;
function Chaine return Boolean is Ok : Boolean := True;
begin
while Lex.Get_Token = Ampersand loop
Lex.Next;
if Lex.Get_Token /= Right_Sentence then
Ok := False;
Error.Syn (Chaine, Follow_Chaine);
else
Lex.Next;
end if;
end loop;
return Ok;
end Chaine;
function Valeur return Boolean is
Ok : Boolean := True;
begin
case Lex.Get_Token is
when Number | Identifier =>
Lex.Next;
when Right_Sentence =>
Lex.Next;
Ok := Ok and Chaine;
when others =>
Ok := False;
Error.Syn (Valeur, Follow_Valeur);
end case;
return Ok;
end Valeur;
function Objet return Boolean is
Ok : Boolean := True;
begin
case Lex.Get_Token is
when Identifier | Heros | Lieu =>
Lex.Next;
when others =>
Ok := False;
Error.Syn (Objet, Follow_Objet);
end case;
return Ok;
end Objet;
function Liste_Identificateurs return Boolean is
Ok : Boolean := True;
begin
if Lex.Get_Token = Identifier then
Lex.Next;
while Lex.Get_Token = Comma loop
Lex.Next;
if Lex.Get_Token /= Identifier then
Ok := False;
Error.Syn (Identifier, Follow_Liste_Identificateurs);
else
Lex.Next;
end if;
end loop;
else
Ok := False;
Error.Syn (Identifier, Follow_Liste_Identificateurs);
end if;
return Ok;
end Liste_Identificateurs;
function Liste_Messages_Erreur return Boolean is
Ok : Boolean := True;
begin
while Lex.Get_Token = Message loop
Lex.Next;
if Lex.Get_Token = Erreur then
Lex.Next;
if Lex.Get_Token = Right_Sentence then
Lex.Next;
Ok := Ok and Chaine;
else
Ok := False;
if Lex.Get_Token = Wrong_Sentence then
Error.Syn (Wrong_Sentence,
Follow_Liste_Messages_Erreur);
else
Error.Syn (Sentence, Follow_Liste_Messages_Erreur);
end if;
end if;
else
Ok := False;
Error.Syn (Erreur, Follow_Liste_Messages_Erreur);
end if;
end loop;
return Ok;
end Liste_Messages_Erreur;
function Liste_Enumeres return Boolean is
Ok : Boolean := True;
begin
while Lex.Get_Token = Enumere loop
Lex.Next;
if Lex.Get_Token = Identifier then
Lex.Next;
if Lex.Get_Token = Colon then
Lex.Next;
Ok := Ok and Liste_Identificateurs;
else
Ok := False;
Error.Syn (Colon, Follow_Liste_Enumeres);
end if;
else
Ok := False;
Error.Syn (Idenifier, Folow_Liste_Enumeres);
end if;
end loop;
return Ok;
end Liste_Enumeres;
function Attribut return Boolean is
Ok : Boolean := True
begin
Ok := Ok and type_base;
if lex.Get_token = colon then
lex.Next;
if Lex.Get_Token = Identifier then
Lex.Next;
if Lex.Get_Token = Equal then
Lex.Next;
Ok := Ok and Valeur;
end if;
else
Ok := False;
Error.syn(identifier, follow_attribut);
else
ok := false;
error.syn(colon, follow_attribut);
return Ok;
end Attribut;
function Corps_Structure return Boolean is
Ok : Boolean := True;
begin
if Lex.Get_Token = Avec then
lex.Next;
if Lex.Get_Token = En then
Ok := Ok and Attribut;
while Lex.Get_Token = En loop
Lex.Next;
Ok := Ok and Attribut;
end loop;
else
Ok := False;
Error.syn(en, follow_attribut);
end if;
end if;
return Ok;
end Corps_Structure;
function Liste_Structures return Boolean is
Ok : Boolean := True;
begin
while Lex.Get_Token = Structure loop
Lex.Next;
if Lex.Get_Token = Identifier then
Lex.Next;
if Lex.Get_Token = Est then
Lex.Next;
Ok := Ok and Type_Structure;
Ok := Ok and Corps_Structure;
else
Ok := False;
Error.Syn (Est, Follow_Liste_Structures);
end if;
else
Ok := False;
Error.Syn (Identifier, Follow_Liste_Structures);
end if;
end loop;
return Ok;
end Liste_Structures;
function champ return boolean is
ok : boolean := true;
begin
if lex.get_token = equal then
lex.next;
ok := ok and valeur;
else
ok := false;
error.syn(equal, follow_champs);
end if;
return ok;
end champ;
function Champs return Boolean is
Ok : Boolean := True;
begin
if Lex.Get_Token = Avec then
Lex.Next;
lex.next;
if lex.get_token = identifier then
lex.next;
ok := ok and champ;
else
ok := false;
error.syn(identifier, follow_champs);
end if;
while Lex.Get_Token = Identifier loop
Lex.Next;
ok := ok and champ;
end loop;
end if;
return Ok;
end Champs;
function Issues return Boolean is
Ok : Boolean := True;
begin
if Lex.Get_Token = Issues then
Lex.Next;
if Lex.Get_Token = Equal then
Lex.Next;
if Lex.Get_Token = Number then
Lex.Next;
else
Ok := False;
Error.syn(number, follow_issues);
end if;
else
Ok := False;
Error.syn(equal, follow_issues);
end if;
end if;
return Ok;
end Issues;
function Mouvement return Boolean is
Ok := Boolean := True;
begin
if Lex.Get_Token = Identifier then
Lex.Next;
if Lex.Get_Token = Colon then
Lex.Next;
if Lex.Get_Token = Number then
Lex.Next;
else
Ok := False;
Error.syn(number, follow_mouvement);
end if;
end if;
else
Ok := False;
Error.syn(identificateur, follow_mouvement);
end if;
return Ok;
end Mouvement;
function Mouvements return Boolean is
Ok : Boolean := True;
begin
Ok := Ok and Mouvement;
while Lex.Get_Token = Comma loop
Lex.Next;
Ok := Ok and Mouvement;
end loop;
return Ok;
end Mouvements;
function Itineraire return Boolean is
Ok : Boolean := True;
begin
if Lex.Get_Token = Itineraire then
Lex.Next;
if Lex.Get_Token = Equal then
Lex.Next;
Ok := Ok and Mouvements;
else
Ok := False;
Error.syn(equal, follow_liste_objets);
end if;
end if;
return Ok;
end Itineraire;
function Corps_Objet return Boolean is
Ok : Boolean := True;
begin
Ok := Ok and Champs;
Ok := Ok and Issues;
Ok := Ok and Itineraires;
end Corps_objet;
function liste_Objets return Boolean is
Ok : Boolean := True;
begin
while Lex.Get_Token = Cree loop
Lex.Next;
Ok := Ok and Type_Structure;
if Lex.Get_Token = Colon then
Ok := Ok and Liste_Identificateurs;
Ok := Ok and Corps_Objet;
else
Ok := False;
Error.(colon, follow_liste_objets);
end if;
end loop;
return Ok;
end liste_Objets;
function Facteur return Boolean is
Ok : Boolean := True;
begin
case Lex.Get_Token is
when Opening_Bracket =>
Lex.Next;
Ok := Ok and Expression;
if Lex.Get_Token = Closing_Bracket then
Lex.Next;
else
Ok := False;
Error.Syn (Closing_Bracket, Follow_Facteur);
end if;
when Identifier =>
Lex.Next;
if Lex.Get_Token = De then
Lex.Next;
Ok := Ok and Objet;
end if;
when Number =>
Lex.Next;
when others =>
Ok := False;
Error.Syn (Facteur, Follow_Facteur);
end case;
return Ok;
end Facteur;
function Terme return Boolean is
First_Terme : constant Token_To_Boolean_Array :=
Token_To_Boolean_Array'(Multiply .. Divide => True, others => False);
Ok : Boolean := True;
begin
Ok := Ok and Facteur;
while First_Terme (Lex.Get_Token) loop
case Lex.Get_Token is
when Multiply | Divide =>
Lex.Next;
Ok := Ok and Facteur;
when others =>
null;
end case;
end loop;
return Ok;
end Terme;
function Expression return Boolean is
First_Expression : constant Token_To_Boolean_Array :=
Token_To_Boolean_Array'(Substract .. Add => True, others => False);
Ok : Boolean := True;
begin
Ok := Ok and Terme;
while First_Expression (Lex.Get_Token) loop
case Lex.Get_Token is
when Add | Substract =>
Lex.Next;
Ok := Ok and Terme;
when others =>
null;
end case;
end loop;
return Ok;
end Expression;
function Symbole_Comparaison return Boolean is
Ok : Boolean := True;
begin
case Lex.Get_Token is
when Equal | Not_Equal | Less | Greater |
Greater_Equal | Less_Equal =>
Lex.Next;
when others =>
Ok := False;
Error.Syn (Symbole_Comparaison, Follow_Symbole_Comparaison);
end case;
return Ok;
end Symbole_Comparaison;
function Suite_Condition_Forte return Boolean is
Ok : Boolean := True;
begin
case Lex.Get_Token is
when De =>
Lex.Next;
Ok := Ok and Objet;
Ok := Ok and Symbole_Comparaison;
Ok := Ok and Expression;
when Pas =>
Lex.Next;
if Lex.Get_Token = Dans then
Lex.Next;
Ok := Ok and Objet;
else
Ok := False;
Error.Syn (Dans, Follow_Suite_Condition_Forte);
end if;
when Dans =>
Lex.Next;
Ok := Ok and Objet;
when Existe =>
Lex.Next;
if Lex.Get_Token = Pas then
Lex.Next;
end if;
when others =>
Ok := False;
Error.Syn (Suite_Condition_Forte, Follow_Suite_Condition_Forte);
end case;
return Ok;
end Suite_Condition_Forte;
function Condition_Forte return Boolean is
Ok : Boolean := True;
begin
case Lex.Get_Token is
when Identifier =>
Lex.Next;
Ok := Ok and Suite_Condition_Forte;
when Heros | Lieu =>
Lex.Next;
if Lex.Get_Token = Equal then
Lex.Next;
if Lex.Get_Token = Identifier then
Lex.Next;
else
Ok := False;
Error.Syn (Identifier, Follow_Condition_Forte);
end if;
else
Ok := False;
Error.Syn (Equal, Follow_Condition_Forte);
end if;
when Number =>
Lex.Next;
if Lex.Get_Token = Actions then
Lex.Next;
if Lex.Get_Token = Passees then
Lex.Next;
else
Ok := False;
Error.Syn (Passees, Follow_Condition_Forte);
end if;
else
Ok := False;
Error.Syn (Actions, Follow_Condition_Forte);
end if;
when Rencontre =>
Lex.Next;
if Lex.Get_Token = Identifier then
Lex.Next;
else
Ok := False;
Error.Syn (Identifier, Follow_Condition_Forte);
end if;
when others =>
Ok := False;
Error.Syn (Condition_Forte, Follow_Condition_Forte);
end case;
return Ok;
end Condition_Forte;
function Condition_Faible return Boolean is
First_Condition_Faible : constant Token_To_Boolean_Array :=
Token_To_Boolean_Array'(Et => True, others => False);
Ok : Boolean := True;
begin
Ok := Ok and Condition_Forte;
while First_Condition_Faible (Lex.Get_Token) loop-- a simplifier
case Lex.Get_Token is
when Et =>
Ok := Ok and Condition_Forte;
when others =>
null;
end case;
end loop;
return Ok;
end Condition_Faible;
function Condition return Boolean is
First_Condition : constant Token_To_Boolean_Array :=
Token_To_Boolean_Array'(Ou => True, others => False);
Ok : Boolean := True;
begin
Ok := Ok and Condition_Faible;
while First_Condition (Lex.Get_Token) loop-- a simplifier
case Lex.Get_Token is
when Ou =>
Ok := Ok and Condition_Faible;
when others =>
null;
end case;
end loop;
return Ok;
end Condition;
function Si return Boolean is
Ok : Boolean := True;
begin
Ok := Ok and Condition; -- synchronise sur alors
if Lex.Get_Token = Alors then
Lex.Next;
Ok := Ok and Instructions_Simples; --synchronise sur fin
if Lex.Get_Token = Fin then
Lex.Next;
if Lex.Get_Token = Si then
Lex.Next;
else
Ok := False;
Error.Syn (Si, Follow_Instruction_Simple);
end if;
else
Ok := False;
Error.Syn (Fin, Follow_Instruction_Simple);
end if;
else
Ok := False;
Error.Syn (Alors, Follow_Instruction_Simple);
end if;
return Ok;
end Si;
function Change return Boolean is
Ok : Boolean := True;
begin
case Lex.Get_Token is
when Identifier =>
Lex.Next;
if Lex.Get_Token = De then
Lex.Next;
Ok := Ok and Objet;
if Lex.Get_Token = En then
Lex.Next;
Put_Line ("ch ex 1");
Ok := Ok and Expression;
Put_Line ("ch ex 2");
else
Put_Line ("ch en");
Ok := False;
Error.Syn (En, Follow_Instruction_Simple);
end if;
else
Ok := False;
Error.Syn (De, Follow_Instruction_Simple);
end if;
when Heros | Lieu =>
Lex.Next;
if Lex.Get_Token = En then
Lex.Next;
if Lex.Get_Token = Identifier then
Lex.Next;
else
Ok := False;
Error.Syn (Identifier, Follow_Instruction_Simple);
end if;
else
Ok := False;
Error.Syn (En, Follow_Instruction_Simple);
end if;
when others =>
Ok := False;
Error.Syn (Change, Follow_Instruction_Simple);
end case;
return Ok;
end Change;
function Quoi_Afficher return Boolean is
Ok : Boolean := True;
begin
case Lex.Get_Token is
when Right_Sentence =>
Lex.Next;
when Wrong_Sentence =>
Ok := False;
Error.Syn (Wrong_Sentence, Follow_Quoi_Afficher);
when Number =>
Lex.Next;
when Identifier =>
Lex.Next;
if Lex.Get_Token = De then
Lex.Next;
Ok := Ok and Objet;
else
Ok := False;
Error.Syn (De, Follow_Quoi_Afficher);
end if;
when Issue =>
Lex.Next;
if Lex.Get_Token = Identifier then
Lex.Next;
else
Ok := False;
Error.Syn (Identifier, Follow_Quoi_Afficher);
end if;
when Issues =>
Lex.Next;
when Contenu =>
Lex.Next;
if Lex.Get_Token = De then
Lex.Next;
Ok := Ok and Objet;
else
Ok := False;
Error.Syn (De, Follow_Quoi_Afficher);
end if;
when others =>
Ok := False;
Error.Syn (Quoi_Afficher, Follow_Quoi_Afficher);
end case;
return Ok;
end Quoi_Afficher;
function Liste_Affiche return Boolean is
First_Liste_Affiche : constant Token_To_Boolean_Array :=
Token_To_Boolean_Array'(Ampersand => True, others => False);
Ok : Boolean := True;
begin
Ok := Ok and Quoi_Afficher;
while (First_Liste_Affiche (Lex.Get_Token)) loop -- a simplifier
case Lex.Get_Token is
when Ampersand =>
Lex.Next;
Ok := Ok and Quoi_Afficher;
when others =>
null;
end case;
end loop;
return Ok;
end Liste_Affiche;
function Ligne return Boolean is
Ok : Boolean := True;
begin
if Lex.Get_Token = Suivante then
Lex.Next;
else
Ok := False;
Error.Syn (Suivante, Follow_Instruction_Simple); -- suivante inutile
end if;
return Ok;
end Ligne;
function Bouge return Boolean is
Ok : Boolean := True;
begin
if Lex.Get_Token = Anime then
Lex.Next;
else
Ok := False;
Error.Syn (Anime, Follow_Instruction_Simple); -- anime inutile
end if;
return Ok;
end Bouge;
function Place return Boolean is
Ok : Boolean := True;
begin
Ok := Ok and Liste_Identificateurs; -- synchronise sur dans
if Lex.Get_Token = Dans then
Lex.Next;
Ok := Ok and Objet;
else
Ok := False;
Error.Syn (Dans, Follow_Instruction_Simple); -- dans inutile
end if;
return Ok;
end Place;
function Va return Boolean is
Ok : Boolean := True;
begin
if Lex.Get_Token = Vers then
Lex.Next;
if Lex.Get_Token = Identifier then
Lex.Next;
else
Ok := False;
Error.Syn (Identifier, Follow_Instruction_Simple);
end if;
else
Ok := False;
Error.Syn (Vers, Follow_Instruction_Simple);
end if;
return Ok;
end Va;
function Instructions_Simples return Boolean is
First_Instructions_Simples : constant Token_To_Boolean_Array :=
Token_To_Boolean_Array'(Si .. Va => True, others => False);
Ok : Boolean := True;
begin
while First_Instructions_Simples (Lex.Get_Token) loop
case Lex.Get_Token is
when Si =>
Lex.Next;
Ok := Ok and Si;
when Change =>
Lex.Next;
Ok := Ok and Change;
when Affiche =>
Lex.Next;
Ok := Ok and Liste_Affiche;
when Ligne =>
Lex.Next;
Ok := Ok and Ligne;
when Bouge =>
Lex.Next;
Ok := Ok and Bouge;
when Place =>
Lex.Next;
Ok := Ok and Place;
when Retire =>
Lex.Next;
Ok := Ok and Liste_Identificateurs;
when Termine =>
Lex.Next;
when Va =>
Lex.Next;
Ok := Ok and Va;
when Efface =>
Lex.Next;
when others =>
null;
end case;
end loop;
return Ok;
end Instructions_Simples;
function Jeu_Aventure return Boolean is
Ok : Boolean := True;
begin
Ok := Ok and Instructions_Simples;
return Ok;
end Jeu_Aventure;
procedure Start is
begin
Lex.Initialize;
if Jeu_Aventure then
Put_Line ("Sentence is Ok");
else
Put_Line ("Sentence is false");
end if;
end Start;
end Syn;
nblk1=1d
nid=c
hdr6=34
[0x00] rec0=26 rec1=00 rec2=01 rec3=002
[0x01] rec0=26 rec1=00 rec2=13 rec3=054
[0x02] rec0=22 rec1=00 rec2=02 rec3=016
[0x03] rec0=1b rec1=00 rec2=16 rec3=054
[0x04] rec0=1f rec1=00 rec2=17 rec3=020
[0x05] rec0=24 rec1=00 rec2=0a rec3=028
[0x06] rec0=21 rec1=00 rec2=06 rec3=00c
[0x07] rec0=24 rec1=00 rec2=05 rec3=004
[0x08] rec0=26 rec1=00 rec2=0e rec3=026
[0x09] rec0=25 rec1=00 rec2=0b rec3=010
[0x0a] rec0=25 rec1=00 rec2=09 rec3=024
[0x0b] rec0=20 rec1=00 rec2=12 rec3=030
[0x0c] rec0=24 rec1=00 rec2=15 rec3=022
[0x0d] rec0=20 rec1=00 rec2=0d rec3=016
[0x0e] rec0=1a rec1=00 rec2=14 rec3=01e
[0x0f] rec0=1e rec1=00 rec2=0f rec3=016
[0x10] rec0=24 rec1=00 rec2=11 rec3=00a
[0x11] rec0=20 rec1=00 rec2=10 rec3=014
[0x12] rec0=19 rec1=00 rec2=1a rec3=028
[0x13] rec0=20 rec1=00 rec2=19 rec3=018
[0x14] rec0=1d rec1=00 rec2=1d rec3=078
[0x15] rec0=28 rec1=00 rec2=07 rec3=02c
[0x16] rec0=25 rec1=00 rec2=18 rec3=042
[0x17] rec0=1f rec1=00 rec2=08 rec3=01a
[0x18] rec0=28 rec1=00 rec2=03 rec3=010
[0x19] rec0=01 rec1=00 rec2=04 rec3=000
[0x1a] rec0=00 rec1=00 rec2=00 rec3=000
[0x1b] rec0=00 rec1=00 rec2=00 rec3=000
[0x1c] rec0=00 rec1=00 rec2=00 rec3=000
tail 0x2173f0422860a3551dae8 0x42a00088462060003
Free Block Chain:
0xc: 0000 00 1b 03 fc 80 1c 20 20 20 20 20 20 20 4f 6b 20 ┆ Ok ┆
0x1b: 0000 00 1c 01 f1 80 13 6c 6c 6f 77 5f 6c 69 73 74 65 ┆ llow_liste┆
0x1c: 0000 00 00 00 04 80 01 6e 01 00 00 00 40 00 00 00 3d ┆ n @ =┆