
{ nichtterminale Symbole einlesen }
assign(grammar_file,'GRAMMAR.DTA'); reset(grammar_file);
readln(grammar_file,nonterm_anz);
for i:=1 to nonterm_anz do
  read(grammar_file,nue[i]);
readln(grammar_file);
writeln(nonterm_anz,' Nonterminals');
for i:=1 to nonterm_anz do
  write(nue[i]:symbol_laenge);
writeln;

{ terminale Symbole einlesen }
readln(grammar_file,term_anz);
for i:=1 to term_anz do
  read(grammar_file,sigma[i]);
readln(grammar_file);
writeln(term_anz,' Terminals');
for i:=1 to term_anz do
  write(sigma[i]:symbol_laenge);
writeln;

{ Produktionen einlesen }
readln(grammar_file,prod_anz);
for i:=1 to prod_anz do
  begin
  read(grammar_file,prod_nr[i],prod[i]);
  readln(grammar_file);
  end;
writeln(prod_anz,' Produktionen');
{for i:=1 to prod_anz do
  writeln(prod_nr[i]:2,')   ',prod[i]);
}
{ Parser Table einlesen }
for i:=1 to nonterm_anz do
  begin
  readln(grammar_file,alter_anz[i]);
  for j:=1 to alter_anz[i] do
    begin
    for k:=1 to term_anz do
      read(grammar_file,table[i,k,j]);
    insert(blanks,table[i,term_anz,j],length(table[i,term_anz,j])+1);
    readln(grammar_file)
    end;
  end;

{ Table anzeigen
writeln('Parser Table');
for i:=1 to nonterm_anz do
  for j:=1 to alter_anz[i] do
    begin
    if j=1 then write(nue[i],':   ')
    else
    write('       ');
    for k:=1 to term_anz do
      write(table[i,k,j],'  ');
    writeln;
    end;
}
