/[bison]/bison/src/reader.c
ViewVC logotype

Diff of /bison/src/reader.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.206 by akim, Thu Jul 25 21:21:02 2002 UTC revision 1.207 by akim, Mon Jul 29 17:30:33 2002 UTC
# Line 475  reader (void) Line 475  reader (void)
475    /* Initialize the symbol table.  */    /* Initialize the symbol table.  */
476    symbols_new ();    symbols_new ();
477    
478    /* Construct the axiom symbol. */    /* Construct the accept symbol. */
479    axiom = symbol_get ("$axiom", empty_location);    accept = symbol_get ("$accept", empty_location);
480    axiom->class = nterm_sym;    accept->class = nterm_sym;
481    axiom->number = nvars++;    accept->number = nvars++;
482    
483    /* Construct the error token */    /* Construct the error token */
484    errtoken = symbol_get ("error", empty_location);    errtoken = symbol_get ("error", empty_location);
# Line 487  reader (void) Line 487  reader (void)
487    
488    /* Construct a token that represents all undefined literal tokens.    /* Construct a token that represents all undefined literal tokens.
489       It is always token number 2.  */       It is always token number 2.  */
490    undeftoken = symbol_get ("$undefined.", empty_location);    undeftoken = symbol_get ("$undefined", empty_location);
491    undeftoken->class = token_sym;    undeftoken->class = token_sym;
492    undeftoken->number = ntokens++;    undeftoken->number = ntokens++;
493    
# Line 515  reader (void) Line 515  reader (void)
515    /* Report any undefined symbols and consider them nonterminals.  */    /* Report any undefined symbols and consider them nonterminals.  */
516    symbols_check_defined ();    symbols_check_defined ();
517    
518    /* If the user did not define her EOFTOKEN, do it now. */    /* If the user did not define her ENDTOKEN, do it now. */
519    if (!eoftoken)    if (!endtoken)
520      {      {
521        eoftoken = symbol_get ("$", empty_location);        endtoken = symbol_get ("$end", empty_location);
522        eoftoken->class = token_sym;        endtoken->class = token_sym;
523        eoftoken->number = 0;        endtoken->number = 0;
524        /* Value specified by POSIX.  */        /* Value specified by POSIX.  */
525        eoftoken->user_token_number = 0;        endtoken->user_token_number = 0;
526      }      }
527    
528    /* Insert the initial rule, which line is that of the first rule    /* Insert the initial rule, which line is that of the first rule
529       (not that of the start symbol):       (not that of the start symbol):
530    
531       axiom: %start EOF.  */       accept: %start EOF.  */
532    {    {
533      symbol_list_t *p = symbol_list_new (axiom, empty_location);      symbol_list_t *p = symbol_list_new (accept, empty_location);
534      p->location = grammar->location;      p->location = grammar->location;
535      p->next = symbol_list_new (startsymbol, empty_location);      p->next = symbol_list_new (startsymbol, empty_location);
536      p->next->next = symbol_list_new (eoftoken, empty_location);      p->next->next = symbol_list_new (endtoken, empty_location);
537      p->next->next->next = symbol_list_new (NULL, empty_location);      p->next->next->next = symbol_list_new (NULL, empty_location);
538      p->next->next->next->next = grammar;      p->next->next->next->next = grammar;
539      nrules += 1;      nrules += 1;

Legend:
Removed from v.1.206  
changed lines
  Added in v.1.207

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26