text
stringlengths
0
234
Output.P (" type Action_Code is mod 2 ** 16;");
Output.P (" for Action_Code'Size use 16;");
Output.P;
Output.P (" Action_Table : constant array");
Output.N (" (State_Index range 1 .. ");
Output.N (Natural (Anagram.Grammars.LR_Tables.Last_State (Table.all)));
Output.P (",");
Output.N (" Anagram.Grammars.Terminal_Count range 0 .. ");
Output.N (Natural (Plain.Last_Terminal));
Output.P (") of Action_Code :=");
for State in 1 .. Anagram.Grammars.LR_Tables.Last_State (Table.all) loop
if State = 1 then
Output.N (" (");
else
Output.P (",");
Output.N (" ");
end if;
Output.N (Natural (State));
Output.P (" =>");
Output.N (" (");
Count := 0;
for T in 0 .. Plain.Last_Terminal loop
declare
use Anagram.Grammars.LR_Tables;
S : constant Anagram.Grammars.LR.State_Count :=
Shift (Table.all, State, T);
R : constant Reduce_Iterator := Reduce (Table.all, State, T);
begin
if S /= 0 then
Code := Action_Code (S) + 16#80_00#;
elsif not Is_Empty (R) then
Code := Action_Code (Production (R));
else
Code := 0;
end if;
if Code /= 0 then
Output.N (Natural (T));
Output.N (" => ");
Output.N (Natural (Code));
Count := Count + 1;
if Count < 4 then
Output.N (", ");
else
Count := 0;
Output.P (",");
Output.N (" ");
end if;
end if;
Function Definition: procedure Print_Go_To is
Function Body: Count : Natural;
begin
Output.P (" Go_To_Table : constant array");
Output.N (" (Anagram.Grammars.LR_Parsers.State_Index range 1 .. ");
Output.N (Natural (Anagram.Grammars.LR_Tables.Last_State (Table.all)));
Output.P (",");
Output.N (" Anagram.Grammars.Non_Terminal_Index range 1 .. ");
Output.N (Natural (Plain.Last_Non_Terminal));
Output.P (") of State_Index :=");
for State in 1 .. Anagram.Grammars.LR_Tables.Last_State (Table.all) loop
if State = 1 then
Output.N (" (");
else
Output.P (",");
Output.N (" ");
end if;
Output.N (Natural (State));
Output.P (" =>");
Output.N (" (");
Count := 0;
for NT in 1 .. Plain.Last_Non_Terminal loop
declare
use Anagram.Grammars.LR;
Next : constant State_Count :=
Anagram.Grammars.LR_Tables.Shift (Table.all, State, NT);
begin
if Next /= 0 then
Output.N (Natural (NT));
Output.N (" => ");
Output.N (Natural (Next));
Count := Count + 1;
if Count < 4 then
Output.N (", ");
else
Count := 0;
Output.P (",");
Output.N (" ");
end if;
end if;
Function Definition: procedure Dump_Standard is
Function Body: procedure Print (View : Program.Visibility.View);
procedure Print (View : Program.Visibility.View_Array);
Ctx : aliased Program.Plain_Contexts.Context;