]> git.saurik.com Git - bison.git/blobdiff - doc/bison.texinfo
* NEWS: Bison-generated C parsers now use the _ macro to
[bison.git] / doc / bison.texinfo
index 0bf1c0daec343423223a304050c7ae07fb1318da..b07c31a1c7d8f79634a29c215dd64ac8f07958d5 100644 (file)
@@ -444,7 +444,7 @@ roughly that the next grammar rule to apply at any point in the input is
 uniquely determined by the preceding input and a fixed, finite portion
 (called a @dfn{look-ahead}) of the remaining input.  A context-free
 grammar can be @dfn{ambiguous}, meaning that there are multiple ways to
-apply the grammar rules to get the some inputs.  Even unambiguous
+apply the grammar rules to get the same inputs.  Even unambiguous
 grammars can be @dfn{non-deterministic}, meaning that no fixed
 look-ahead always suffices to determine the next grammar rule to apply.
 With the proper declarations, Bison is also able to parse these more
@@ -1166,7 +1166,14 @@ start with a function called @code{main}; you have to provide this, and
 arrange for it to call @code{yyparse} or the parser will never run.
 @xref{Interface, ,Parser C-Language Interface}.
 
-Aside from the token type names and the symbols in the actions you
+If your code defines a C preprocessor macro @code{_} (a single
+underscore), Bison assumes that it can be used to translate
+English-language strings to the user's preferred language using a
+function-like syntax, e.g., @code{_("syntax error")}.  Otherwise,
+Bison defines a no-op macro by that name that merely returns its
+argument, so strings are not translated.
+
+Aside from @code{_} and the token type names and the symbols in the actions you
 write, all symbols defined in the Bison parser file itself
 begin with @samp{yy} or @samp{YY}.  This includes interface functions
 such as the lexical analyzer function @code{yylex}, the error reporting
@@ -2272,7 +2279,7 @@ typedef struct symrec symrec;
 /* The symbol table: a chain of `struct symrec'.  */
 extern symrec *sym_table;
 
-symrec *putsym (char const *, func_t);
+symrec *putsym (char const *, int);
 symrec *getsym (char const *);
 @end group
 @end smallexample
@@ -2627,7 +2634,7 @@ not come before the definition of @code{yyparse}.  For example, the
 definitions of @code{yylex} and @code{yyerror} often go here.  Because
 C requires functions to be declared before being used, you often need
 to declare functions like @code{yylex} and @code{yyerror} in the Prologue,
-even if you define them inhe Epilogue.
+even if you define them in the Epilogue.
 @xref{Interface, ,Parser C-Language Interface}.
 
 If the last section is empty, you may omit the @samp{%%} that separates it
@@ -5784,9 +5791,13 @@ redeclare a typedef name provided an explicit type has been specified
 earlier:
 
 @example
-typedef int foo, bar, lose;
-static foo (bar);        /* @r{redeclare @code{bar} as static variable} */
-static int foo (lose);   /* @r{redeclare @code{foo} as function} */
+typedef int foo, bar;
+int baz (void)
+@{
+  static bar (bar);      /* @r{redeclare @code{bar} as static variable} */
+  extern foo foo (foo);  /* @r{redeclare @code{foo} as function} */
+  return foo (bar);
+@}
 @end example
 
 Unfortunately, the name being declared is separated from the declaration