1451 |
t = lex (); |
t = lex (); |
1452 |
} |
} |
1453 |
|
|
1454 |
|
/* grammar has been read. Do some checking */ |
1455 |
|
|
1456 |
|
if (nrules == 0) |
1457 |
|
fatal (_("no rules in the input grammar")); |
1458 |
|
|
1459 |
|
/* Report any undefined symbols and consider them nonterminals. */ |
1460 |
|
|
1461 |
|
for (bp = firstsymbol; bp; bp = bp->next) |
1462 |
|
if (bp->class == unknown_sym) |
1463 |
|
{ |
1464 |
|
complain (_ |
1465 |
|
("symbol %s is used, but is not defined as a token and has no rules"), |
1466 |
|
bp->tag); |
1467 |
|
bp->class = nterm_sym; |
1468 |
|
bp->value = nvars++; |
1469 |
|
} |
1470 |
|
|
1471 |
/* Insert the initial rule, which line is that of the first rule |
/* Insert the initial rule, which line is that of the first rule |
1472 |
(not that of the start symbol): |
(not that of the start symbol): |
1473 |
|
|
1483 |
grammar = p; |
grammar = p; |
1484 |
startval = axiom; |
startval = axiom; |
1485 |
|
|
|
/* grammar has been read. Do some checking */ |
|
|
|
|
1486 |
if (nsyms > MAXSHORT) |
if (nsyms > MAXSHORT) |
1487 |
fatal (_("too many symbols (tokens plus nonterminals); maximum %d"), |
fatal (_("too many symbols (tokens plus nonterminals); maximum %d"), |
1488 |
MAXSHORT); |
MAXSHORT); |
|
if (nrules == 0) |
|
|
fatal (_("no rules in the input grammar")); |
|
|
|
|
|
/* Report any undefined symbols and consider them nonterminals. */ |
|
|
|
|
|
for (bp = firstsymbol; bp; bp = bp->next) |
|
|
if (bp->class == unknown_sym) |
|
|
{ |
|
|
complain (_ |
|
|
("symbol %s is used, but is not defined as a token and has no rules"), |
|
|
bp->tag); |
|
|
bp->class = nterm_sym; |
|
|
bp->value = nvars++; |
|
|
} |
|
1489 |
|
|
1490 |
ntokens = nsyms - nvars; |
ntokens = nsyms - nvars; |
1491 |
} |
} |