|
|
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: 5282 (0x14a2)
Types: TextFile
Names: »B«
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
└─⟦d65440be7⟧ »DATA«
└─⟦this⟧
with Lex, Token;
package body Syntaxe is
Error : exception;
procedure Parse_Expr (Afile : Text_Io.File_Type);
procedure Parse_Fact (Afile : Text_Io.File_Type) is
begin
Text_Io.Put_Line ("ca demarre parseFact ");
case Lex.Lexgettoken is
when Token.L_Parentheseg =>
Lex.Lexnexttoken (Afile);
Parse_Expr (Afile);
if Token.Object'Pos (Lex.Lexgettoken) =
Token.Object'Pos (Token.L_Parenthesed) then
Lex.Lexnexttoken (Afile);
else
raise Error;
end if;
when Token.L_Id =>
Lex.Lexnexttoken (Afile);
when Token.L_Int =>
Lex.Lexnexttoken (Afile);
when others =>
raise Error;
end case;
end Parse_Fact;
procedure Parse_Term (Afile : Text_Io.File_Type) is
T_Token : Token.Object;
begin
-- text_IO.Put_Line("ca demarre parseTerm ");
Parse_Fact (Afile);
-- text_IO.Put_Line("ca a marche parseFact ");
T_Token := Lex.Lexgettoken;
while Token.Object'Pos (T_Token) = Token.Object'Pos (Token.L_Star) or
Token.Object'Pos (T_Token) =
Token.Object'Pos (Token.L_Slash) loop
case T_Token is
when Token.L_Star =>
Lex.Lexnexttoken (Afile);
Parse_Fact (Afile);
-- text_IO.Put_Line("ca a marche parseFact ");
when Token.L_Div =>
Lex.Lexnexttoken (Afile);
Parse_Fact (Afile);
-- text_IO.Put_Line("ca a marche parseFact ");
when others =>
null;
end case;
T_Token := Lex.Lexgettoken;
end loop;
-- text_IO.Put_Line("ca a marche parseTerm ");
end Parse_Term;
procedure Parse_Expr (Afile : Text_Io.File_Type) is
T_Token : Token.Object;
begin
-- text_IO.Put_Line("ca demarre parseExpr ");
Parse_Term (Afile);
T_Token := Lex.Lexgettoken;
while Token.Object'Pos (T_Token) = Token.Object'Pos (Token.L_Plus) or
Token.Object'Pos (T_Token) =
Token.Object'Pos (Token.L_Moins) loop
case T_Token is
when Token.L_Plus =>
Lex.Lexnexttoken (Afile);
Parse_Term (Afile);
when Token.L_Moins =>
Lex.Lexnexttoken (Afile);
Parse_Term (Afile);
when others =>
null;
end case;
T_Token := Lex.Lexgettoken;
end loop;
-- text_IO.Put_Line("ca a marche parseExpr ");
end Parse_Expr;
procedure Parse_Inst (Afile : Text_Io.File_Type) is
begin
-- text_IO.Put_Line("ca demarre parseInst ");
if Token.Object'Pos (Lex.Lexgettoken) =
Token.Object'Pos (Token.L_Id) then
Lex.Lexnexttoken (Afile);
if Token.Object'Pos (Lex.Lexgettoken) =
Token.Object'Pos (Token.L_Egal) then
Lex.Lexnexttoken (Afile);
Parse_Expr (Afile);
else
raise Error;
end if;
else
raise Error;
end if;
end Parse_Inst;
procedure Parse_Liste (Afile : Text_Io.File_Type) is
begin
-- text_IO.Put_Line("ca demarre parseListe ");
while Token.Object'Pos (Lex.Lexgettoken) /=
Token.Object'Pos (Token.L_Fin) loop
Parse_Inst (Afile);
-- text_IO.Put_Line("ca a marche parseInst ");
if Token.Object'Pos (Lex.Lexgettoken) =
Token.Object'Pos (Token.L_Virgule) then
Lex.Lexnexttoken (Afile);
else
raise Error;
end if;
end loop;
-- text_IO.Put_Line("ca a marche parseliste ");
end Parse_Liste;
procedure Parse_Corps (Afile : Text_Io.File_Type) is
begin
if Token.Object'Pos (Lex.Lexgettoken) =
Token.Object'Pos (Token.L_Avec) then
-- text_IO.Put_Line("ca demarre parseCorps ");
Lex.Lexnexttoken (Afile);
Parse_Liste (Afile);
if Token.Object'Pos (Lex.Lexgettoken) =
Token.Object'Pos (Token.L_Fin) then
Lex.Lexnexttoken (Afile);
else
raise Error;
end if;
else
raise Error;
end if;
end Parse_Corps;
procedure Parse_Start (Afile : Text_Io.File_Type) is
begin
if Token.Object'Pos (Lex.Lexgettoken) =
Token.Object'Pos (Token.L_Faire) then
Lex.Lexnexttoken (Afile);
-- text_IO.Put_Line("ca demarre parseStart ");
Parse_Corps (Afile);
-- text_IO.Put_Line("ca a marche parseCorps ");
else
raise Error;
end if;
-- text_IO.Put_Line("ca a marche parseStart ");
end Parse_Start;
function Parse (Afile : Text_Io.File_Type) return Boolean is
begin
Lex.Lexopen (Afile);
Lex.Lexnexttoken (Afile);
-- text_IO.Put_Line("ca demarre parse ");
Parse_Start (Afile);
return True;
exception
when Error =>
return False;
end Parse;
end Syntaxe;