]> git.saurik.com Git - bison.git/blobdiff - doc/bison.texinfo
doc: spell check.
[bison.git] / doc / bison.texinfo
index 0f4dec26353f8c80ba2aea4afd1ac59df5970256..6574704a8d2a161c165d18ea7ac55f06fc026cca 100644 (file)
@@ -536,7 +536,6 @@ lexicography, not grammar.)
 
 Here is a simple C function subdivided into tokens:
 
-@ifinfo
 @example
 int             /* @r{keyword `int'} */
 square (int x)  /* @r{identifier, open-paren, keyword `int',}
@@ -546,16 +545,6 @@ square (int x)  /* @r{identifier, open-paren, keyword `int',}
                    @r{identifier, semicolon} */
 @}               /* @r{close-brace} */
 @end example
-@end ifinfo
-@ifnotinfo
-@example
-int             /* @r{keyword `int'} */
-square (int x)  /* @r{identifier, open-paren, keyword `int', identifier, close-paren} */
-@{               /* @r{open-brace} */
-  return x * x; /* @r{keyword `return', identifier, asterisk, identifier, semicolon} */
-@}               /* @r{close-brace} */
-@end example
-@end ifnotinfo
 
 The syntactic groupings of C include the expression, the statement, the
 declaration, and the function definition.  These are represented in the
@@ -637,8 +626,7 @@ the statement; the naked semicolon, and the colon, are Bison punctuation
 used in every rule.
 
 @example
-stmt:   RETURN expr ';'
-        ;
+stmt: RETURN expr ';' ;
 @end example
 
 @noindent
@@ -710,8 +698,7 @@ For example, here is a rule that says an expression can be the sum of
 two subexpressions:
 
 @example
-expr: expr '+' expr   @{ $$ = $1 + $3; @}
-        ;
+expr: expr '+' expr   @{ $$ = $1 + $3; @} ;
 @end example
 
 @noindent
@@ -890,30 +877,32 @@ parses a vastly simplified form of Pascal type declarations.
 %%
 
 @group
-type_decl : TYPE ID '=' type ';'
-     ;
+type_decl: TYPE ID '=' type ';' ;
 @end group
 
 @group
-type : '(' id_list ')'
-     | expr DOTDOT expr
-     ;
+type:
+  '(' id_list ')'
+| expr DOTDOT expr
+;
 @end group
 
 @group
-id_list : ID
-     | id_list ',' ID
-     ;
+id_list:
+  ID
+| id_list ',' ID
+;
 @end group
 
 @group
-expr : '(' expr ')'
-     | expr '+' expr
-     | expr '-' expr
-     | expr '*' expr
-     | expr '/' expr
-     | ID
-     ;
+expr:
+  '(' expr ')'
+| expr '+' expr
+| expr '-' expr
+| expr '*' expr
+| expr '/' expr
+| ID
+;
 @end group
 @end example
 
@@ -993,30 +982,35 @@ Let's consider an example, vastly simplified from a C++ grammar.
 
 %%
 
-prog :
-     | prog stmt   @{ printf ("\n"); @}
-     ;
+prog:
+  /* Nothing.  */
+| prog stmt   @{ printf ("\n"); @}
+;
 
-stmt : expr ';'  %dprec 1
-     | decl      %dprec 2
-     ;
+stmt:
+  expr ';'  %dprec 1
+| decl      %dprec 2
+;
 
-expr : ID               @{ printf ("%s ", $$); @}
-     | TYPENAME '(' expr ')'
-                        @{ printf ("%s <cast> ", $1); @}
-     | expr '+' expr    @{ printf ("+ "); @}
-     | expr '=' expr    @{ printf ("= "); @}
-     ;
+expr:
+  ID               @{ printf ("%s ", $$); @}
+| TYPENAME '(' expr ')'
+                   @{ printf ("%s <cast> ", $1); @}
+| expr '+' expr    @{ printf ("+ "); @}
+| expr '=' expr    @{ printf ("= "); @}
+;
 
-decl : TYPENAME declarator ';'
-                        @{ printf ("%s <declare> ", $1); @}
-     | TYPENAME declarator '=' expr ';'
-                        @{ printf ("%s <init-declare> ", $1); @}
-     ;
+decl:
+  TYPENAME declarator ';'
+                   @{ printf ("%s <declare> ", $1); @}
+| TYPENAME declarator '=' expr ';'
+                   @{ printf ("%s <init-declare> ", $1); @}
+;
 
-declarator : ID         @{ printf ("\"%s\" ", $1); @}
-     | '(' declarator ')'
-     ;
+declarator:
+  ID               @{ printf ("\"%s\" ", $1); @}
+| '(' declarator ')'
+;
 @end example
 
 @noindent
@@ -1085,9 +1079,10 @@ other.  To do so, you could change the declaration of @code{stmt} as
 follows:
 
 @example
-stmt : expr ';'  %merge <stmtMerge>
-     | decl      %merge <stmtMerge>
-     ;
+stmt:
+  expr ';'  %merge <stmtMerge>
+| decl      %merge <stmtMerge>
+;
 @end example
 
 @noindent
@@ -1494,25 +1489,28 @@ Here are the grammar rules for the reverse polish notation calculator.
 
 @example
 @group
-input:    /* empty */
-        | input line
+input:
+  /* empty */
+| input line
 ;
 @end group
 
 @group
-line:     '\n'
-        | exp '\n'      @{ printf ("\t%.10g\n", $1); @}
+line:
+  '\n'
+| exp '\n'      @{ printf ("%.10g\n", $1); @}
 ;
 @end group
 
 @group
-exp:      NUM           @{ $$ = $1;           @}
-        | exp exp '+'   @{ $$ = $1 + $2;      @}
-        | exp exp '-'   @{ $$ = $1 - $2;      @}
-        | exp exp '*'   @{ $$ = $1 * $2;      @}
-        | exp exp '/'   @{ $$ = $1 / $2;      @}
-        | exp exp '^'   @{ $$ = pow ($1, $2); @}  /* Exponentiation */
-        | exp 'n'       @{ $$ = -$1;          @}  /* Unary minus    */
+exp:
+  NUM           @{ $$ = $1;           @}
+| exp exp '+'   @{ $$ = $1 + $2;      @}
+| exp exp '-'   @{ $$ = $1 - $2;      @}
+| exp exp '*'   @{ $$ = $1 * $2;      @}
+| exp exp '/'   @{ $$ = $1 / $2;      @}
+| exp exp '^'   @{ $$ = pow ($1, $2); @}  /* Exponentiation */
+| exp 'n'       @{ $$ = -$1;          @}  /* Unary minus    */
 ;
 @end group
 %%
@@ -1548,8 +1546,9 @@ rule are referred to as @code{$1}, @code{$2}, and so on.
 Consider the definition of @code{input}:
 
 @example
-input:    /* empty */
-        | input line
+input:
+  /* empty */
+| input line
 ;
 @end example
 
@@ -1582,8 +1581,9 @@ input tokens; we will arrange for the latter to happen at end-of-input.
 Now consider the definition of @code{line}:
 
 @example
-line:     '\n'
-        | exp '\n'  @{ printf ("\t%.10g\n", $1); @}
+line:
+  '\n'
+| exp '\n'  @{ printf ("%.10g\n", $1); @}
 ;
 @end example
 
@@ -1610,21 +1610,22 @@ The second handles an addition-expression, which looks like two expressions
 followed by a plus-sign.  The third handles subtraction, and so on.
 
 @example
-exp:      NUM
-        | exp exp '+'     @{ $$ = $1 + $2;    @}
-        | exp exp '-'     @{ $$ = $1 - $2;    @}
-        @dots{}
-        ;
+exp:
+  NUM
+| exp exp '+'     @{ $$ = $1 + $2;    @}
+| exp exp '-'     @{ $$ = $1 - $2;    @}
+@dots{}
+;
 @end example
 
 We have used @samp{|} to join all the rules for @code{exp}, but we could
 equally well have written them separately:
 
 @example
-exp:      NUM ;
-exp:      exp exp '+'     @{ $$ = $1 + $2;    @} ;
-exp:      exp exp '-'     @{ $$ = $1 - $2;    @} ;
-        @dots{}
+exp: NUM ;
+exp: exp exp '+'     @{ $$ = $1 + $2; @};
+exp: exp exp '-'     @{ $$ = $1 - $2; @};
+@dots{}
 @end example
 
 Most of the rules have actions that compute the value of the expression in
@@ -1645,16 +1646,17 @@ not require it.  You can add or change white space as much as you wish.
 For example, this:
 
 @example
-exp   : NUM | exp exp '+' @{$$ = $1 + $2; @} | @dots{} ;
+exp: NUM | exp exp '+' @{$$ = $1 + $2; @} | @dots{} ;
 @end example
 
 @noindent
 means the same thing as this:
 
 @example
-exp:      NUM
-        | exp exp '+'    @{ $$ = $1 + $2; @}
-        | @dots{}
+exp:
+  NUM
+| exp exp '+'    @{ $$ = $1 + $2; @}
+| @dots{}
 ;
 @end example
 
@@ -1899,26 +1901,29 @@ parentheses nested to arbitrary depth.  Here is the Bison code for
 
 %% /* The grammar follows.  */
 @group
-input:    /* empty */
-        | input line
+input:
+  /* empty */
+| input line
 ;
 @end group
 
 @group
-line:     '\n'
-        | exp '\n'  @{ printf ("\t%.10g\n", $1); @}
+line:
+  '\n'
+| exp '\n'  @{ printf ("\t%.10g\n", $1); @}
 ;
 @end group
 
 @group
-exp:      NUM                @{ $$ = $1;           @}
-        | exp '+' exp        @{ $$ = $1 + $3;      @}
-        | exp '-' exp        @{ $$ = $1 - $3;      @}
-        | exp '*' exp        @{ $$ = $1 * $3;      @}
-        | exp '/' exp        @{ $$ = $1 / $3;      @}
-        | '-' exp  %prec NEG @{ $$ = -$2;          @}
-        | exp '^' exp        @{ $$ = pow ($1, $3); @}
-        | '(' exp ')'        @{ $$ = $2;           @}
+exp:
+  NUM                @{ $$ = $1;           @}
+| exp '+' exp        @{ $$ = $1 + $3;      @}
+| exp '-' exp        @{ $$ = $1 - $3;      @}
+| exp '*' exp        @{ $$ = $1 * $3;      @}
+| exp '/' exp        @{ $$ = $1 / $3;      @}
+| '-' exp  %prec NEG @{ $$ = -$2;          @}
+| exp '^' exp        @{ $$ = pow ($1, $3); @}
+| '(' exp ')'        @{ $$ = $2;           @}
 ;
 @end group
 %%
@@ -1981,9 +1986,10 @@ been added to one of the alternatives for @code{line}:
 
 @example
 @group
-line:     '\n'
-        | exp '\n'   @{ printf ("\t%.10g\n", $1); @}
-        | error '\n' @{ yyerrok;                  @}
+line:
+  '\n'
+| exp '\n'   @{ printf ("\t%.10g\n", $1); @}
+| error '\n' @{ yyerrok;                  @}
 ;
 @end group
 @end example
@@ -2074,41 +2080,44 @@ wrong expressions or subexpressions.
 
 @example
 @group
-input   : /* empty */
-        | input line
+input:
+  /* empty */
+| input line
 ;
 @end group
 
 @group
-line    : '\n'
-        | exp '\n' @{ printf ("%d\n", $1); @}
+line:
+  '\n'
+| exp '\n' @{ printf ("%d\n", $1); @}
 ;
 @end group
 
 @group
-exp     : NUM           @{ $$ = $1; @}
-        | exp '+' exp   @{ $$ = $1 + $3; @}
-        | exp '-' exp   @{ $$ = $1 - $3; @}
-        | exp '*' exp   @{ $$ = $1 * $3; @}
+exp:
+  NUM           @{ $$ = $1; @}
+| exp '+' exp   @{ $$ = $1 + $3; @}
+| exp '-' exp   @{ $$ = $1 - $3; @}
+| exp '*' exp   @{ $$ = $1 * $3; @}
 @end group
 @group
-        | exp '/' exp
-            @{
-              if ($3)
-                $$ = $1 / $3;
-              else
-                @{
-                  $$ = 1;
-                  fprintf (stderr, "%d.%d-%d.%d: division by zero",
-                           @@3.first_line, @@3.first_column,
-                           @@3.last_line, @@3.last_column);
-                @}
-            @}
+| exp '/' exp
+    @{
+      if ($3)
+        $$ = $1 / $3;
+      else
+        @{
+          $$ = 1;
+          fprintf (stderr, "%d.%d-%d.%d: division by zero",
+                   @@3.first_line, @@3.first_column,
+                   @@3.last_line, @@3.last_column);
+        @}
+    @}
 @end group
 @group
-        | '-' exp %prec NEG     @{ $$ = -$2; @}
-        | exp '^' exp           @{ $$ = pow ($1, $3); @}
-        | '(' exp ')'           @{ $$ = $2; @}
+| '-' exp %prec NEG     @{ $$ = -$2; @}
+| exp '^' exp           @{ $$ = pow ($1, $3); @}
+| '(' exp ')'           @{ $$ = $2; @}
 @end group
 @end example
 
@@ -2334,31 +2343,33 @@ those which mention @code{VAR} or @code{FNCT}, are new.
 @comment file: mfcalc.y
 @example
 @group
-input:   /* empty */
-        | input line
+input:
+  /* empty */
+| input line
 ;
 @end group
 
 @group
 line:
-          '\n'
-        | exp '\n'   @{ printf ("\t%.10g\n", $1); @}
-        | error '\n' @{ yyerrok;                  @}
+  '\n'
+| exp '\n'   @{ printf ("%.10g\n", $1); @}
+| error '\n' @{ yyerrok;                @}
 ;
 @end group
 
 @group
-exp:      NUM                @{ $$ = $1;                         @}
-        | VAR                @{ $$ = $1->value.var;              @}
-        | VAR '=' exp        @{ $$ = $3; $1->value.var = $3;     @}
-        | FNCT '(' exp ')'   @{ $$ = (*($1->value.fnctptr))($3); @}
-        | exp '+' exp        @{ $$ = $1 + $3;                    @}
-        | exp '-' exp        @{ $$ = $1 - $3;                    @}
-        | exp '*' exp        @{ $$ = $1 * $3;                    @}
-        | exp '/' exp        @{ $$ = $1 / $3;                    @}
-        | '-' exp  %prec NEG @{ $$ = -$2;                        @}
-        | exp '^' exp        @{ $$ = pow ($1, $3);               @}
-        | '(' exp ')'        @{ $$ = $2;                         @}
+exp:
+  NUM                @{ $$ = $1;                         @}
+| VAR                @{ $$ = $1->value.var;              @}
+| VAR '=' exp        @{ $$ = $3; $1->value.var = $3;     @}
+| FNCT '(' exp ')'   @{ $$ = (*($1->value.fnctptr))($3); @}
+| exp '+' exp        @{ $$ = $1 + $3;                    @}
+| exp '-' exp        @{ $$ = $1 - $3;                    @}
+| exp '*' exp        @{ $$ = $1 * $3;                    @}
+| exp '/' exp        @{ $$ = $1 / $3;                    @}
+| '-' exp  %prec NEG @{ $$ = -$2;                        @}
+| exp '^' exp        @{ $$ = pow ($1, $3);               @}
+| '(' exp ')'        @{ $$ = $2;                         @}
 ;
 @end group
 /* End of grammar.  */
@@ -3261,8 +3272,7 @@ A Bison grammar rule has the following general form:
 
 @example
 @group
-@var{result}: @var{components}@dots{}
-        ;
+@var{result}: @var{components}@dots{};
 @end group
 @end example
 
@@ -3275,8 +3285,7 @@ For example,
 
 @example
 @group
-exp:      exp '+' exp
-        ;
+exp: exp '+' exp;
 @end group
 @end example
 
@@ -3321,10 +3330,11 @@ be joined with the vertical-bar character @samp{|} as follows:
 
 @example
 @group
-@var{result}:    @var{rule1-components}@dots{}
-        | @var{rule2-components}@dots{}
-        @dots{}
-        ;
+@var{result}:
+  @var{rule1-components}@dots{}
+| @var{rule2-components}@dots{}
+@dots{}
+;
 @end group
 @end example
 
@@ -3337,15 +3347,17 @@ comma-separated sequence of zero or more @code{exp} groupings:
 
 @example
 @group
-expseq:   /* empty */
-        | expseq1
-        ;
+expseq:
+  /* empty */
+| expseq1
+;
 @end group
 
 @group
-expseq1:  exp
-        | expseq1 ',' exp
-        ;
+expseq1:
+  exp
+| expseq1 ',' exp
+;
 @end group
 @end example
 
@@ -3365,9 +3377,10 @@ comma-separated sequence of one or more expressions:
 
 @example
 @group
-expseq1:  exp
-        | expseq1 ',' exp
-        ;
+expseq1:
+  exp
+| expseq1 ',' exp
+;
 @end group
 @end example
 
@@ -3380,9 +3393,10 @@ the same construct is defined using @dfn{right recursion}:
 
 @example
 @group
-expseq1:  exp
-        | exp ',' expseq1
-        ;
+expseq1:
+  exp
+| exp ',' expseq1
+;
 @end group
 @end example
 
@@ -3406,15 +3420,17 @@ For example:
 
 @example
 @group
-expr:     primary
-        | primary '+' primary
-        ;
+expr:
+  primary
+| primary '+' primary
+;
 @end group
 
 @group
-primary:  constant
-        | '(' expr ')'
-        ;
+primary:
+  constant
+| '(' expr ')'
+;
 @end group
 @end example
 
@@ -3536,9 +3552,9 @@ Here is a typical example:
 
 @example
 @group
-exp:    @dots{}
-        | exp '+' exp
-            @{ $$ = $1 + $3; @}
+exp:
+@dots{}
+| exp '+' exp     @{ $$ = $1 + $3; @}
 @end group
 @end example
 
@@ -3546,9 +3562,9 @@ Or, in terms of named references:
 
 @example
 @group
-exp[result]:    @dots{}
-        | exp[left] '+' exp[right]
-            @{ $result = $left + $right; @}
+exp[result]:
+@dots{}
+| exp[left] '+' exp[right]  @{ $result = $left + $right; @}
 @end group
 @end example
 
@@ -3595,15 +3611,16 @@ is a case in which you can use this reliably:
 
 @example
 @group
-foo:      expr bar '+' expr  @{ @dots{} @}
-        | expr bar '-' expr  @{ @dots{} @}
-        ;
+foo:
+  expr bar '+' expr  @{ @dots{} @}
+| expr bar '-' expr  @{ @dots{} @}
+;
 @end group
 
 @group
-bar:      /* empty */
-        @{ previous_expr = $0; @}
-        ;
+bar:
+  /* empty */    @{ previous_expr = $0; @}
+;
 @end group
 @end example
 
@@ -3633,9 +3650,9 @@ in the rule.  In this example,
 
 @example
 @group
-exp:    @dots{}
-        | exp '+' exp
-            @{ $$ = $1 + $3; @}
+exp:
+  @dots{}
+| exp '+' exp    @{ $$ = $1 + $3; @}
 @end group
 @end example
 
@@ -3702,11 +3719,11 @@ remove it afterward.  Here is how it is done:
 
 @example
 @group
-stmt:   LET '(' var ')'
-                @{ $<context>$ = push_context ();
-                  declare_variable ($3); @}
-        stmt    @{ $$ = $6;
-                  pop_context ($<context>5); @}
+stmt:
+  LET '(' var ')'
+    @{ $<context>$ = push_context (); declare_variable ($3); @}
+  stmt
+    @{ $$ = $6; pop_context ($<context>5); @}
 @end group
 @end example
 
@@ -3748,15 +3765,19 @@ declare a destructor for that symbol:
 
 %%
 
-stmt:  let stmt
-               @{ $$ = $2;
-                 pop_context ($1); @}
-       ;
+stmt:
+  let stmt
+    @{
+      $$ = $2;
+      pop_context ($1);
+    @};
 
-let:   LET '(' var ')'
-               @{ $$ = push_context ();
-                 declare_variable ($3); @}
-       ;
+let:
+  LET '(' var ')'
+    @{
+      $$ = push_context ();
+      declare_variable ($3);
+    @};
 
 @end group
 @end example
@@ -3775,9 +3796,10 @@ declaration or not:
 
 @example
 @group
-compound: '@{' declarations statements '@}'
-        | '@{' statements '@}'
-        ;
+compound:
+  '@{' declarations statements '@}'
+| '@{' statements '@}'
+;
 @end group
 @end example
 
@@ -3786,12 +3808,13 @@ But when we add a mid-rule action as follows, the rules become nonfunctional:
 
 @example
 @group
-compound: @{ prepare_for_local_variables (); @}
-          '@{' declarations statements '@}'
+compound:
+  @{ prepare_for_local_variables (); @}
+     '@{' declarations statements '@}'
 @end group
 @group
-        | '@{' statements '@}'
-        ;
+|    '@{' statements '@}'
+;
 @end group
 @end example
 
@@ -3808,11 +3831,12 @@ actions into the two rules, like this:
 
 @example
 @group
-compound: @{ prepare_for_local_variables (); @}
-          '@{' declarations statements '@}'
-        | @{ prepare_for_local_variables (); @}
-          '@{' statements '@}'
-        ;
+compound:
+  @{ prepare_for_local_variables (); @}
+    '@{' declarations statements '@}'
+| @{ prepare_for_local_variables (); @}
+    '@{' statements '@}'
+;
 @end group
 @end example
 
@@ -3826,10 +3850,11 @@ does work is to put the action after the open-brace, like this:
 
 @example
 @group
-compound: '@{' @{ prepare_for_local_variables (); @}
-          declarations statements '@}'
-        | '@{' statements '@}'
-        ;
+compound:
+  '@{' @{ prepare_for_local_variables (); @}
+    declarations statements '@}'
+| '@{' statements '@}'
+;
 @end group
 @end example
 
@@ -3842,18 +3867,16 @@ serves as a subroutine:
 
 @example
 @group
-subroutine: /* empty */
-          @{ prepare_for_local_variables (); @}
-        ;
-
+subroutine:
+  /* empty */  @{ prepare_for_local_variables (); @}
+;
 @end group
 
 @group
-compound: subroutine
-          '@{' declarations statements '@}'
-        | subroutine
-          '@{' statements '@}'
-        ;
+compound:
+  subroutine '@{' declarations statements '@}'
+| subroutine '@{' statements '@}'
+;
 @end group
 @end example
 
@@ -3938,24 +3961,25 @@ Here is a basic example using the default data type for locations:
 
 @example
 @group
-exp:    @dots{}
-        | exp '/' exp
-            @{
-              @@$.first_column = @@1.first_column;
-              @@$.first_line = @@1.first_line;
-              @@$.last_column = @@3.last_column;
-              @@$.last_line = @@3.last_line;
-              if ($3)
-                $$ = $1 / $3;
-              else
-                @{
-                  $$ = 1;
-                  fprintf (stderr,
-                           "Division by zero, l%d,c%d-l%d,c%d",
-                           @@3.first_line, @@3.first_column,
-                           @@3.last_line, @@3.last_column);
-                @}
-            @}
+exp:
+  @dots{}
+| exp '/' exp
+    @{
+      @@$.first_column = @@1.first_column;
+      @@$.first_line = @@1.first_line;
+      @@$.last_column = @@3.last_column;
+      @@$.last_line = @@3.last_line;
+      if ($3)
+        $$ = $1 / $3;
+      else
+        @{
+          $$ = 1;
+          fprintf (stderr,
+                   "Division by zero, l%d,c%d-l%d,c%d",
+                   @@3.first_line, @@3.first_column,
+                   @@3.last_line, @@3.last_column);
+        @}
+    @}
 @end group
 @end example
 
@@ -3969,20 +3993,21 @@ example above simply rewrites this way:
 
 @example
 @group
-exp:    @dots{}
-        | exp '/' exp
-            @{
-              if ($3)
-                $$ = $1 / $3;
-              else
-                @{
-                  $$ = 1;
-                  fprintf (stderr,
-                           "Division by zero, l%d,c%d-l%d,c%d",
-                           @@3.first_line, @@3.first_column,
-                           @@3.last_line, @@3.last_column);
-                @}
-            @}
+exp:
+  @dots{}
+| exp '/' exp
+    @{
+      if ($3)
+        $$ = $1 / $3;
+      else
+        @{
+          $$ = 1;
+          fprintf (stderr,
+                   "Division by zero, l%d,c%d-l%d,c%d",
+                   @@3.first_line, @@3.first_column,
+                   @@3.last_line, @@3.last_column);
+        @}
+    @}
 @end group
 @end example
 
@@ -6355,16 +6380,18 @@ factorial operators (@samp{!}), and allow parentheses for grouping.
 
 @example
 @group
-expr:     term '+' expr
-        | term
-        ;
+expr:
+  term '+' expr
+| term
+;
 @end group
 
 @group
-term:     '(' expr ')'
-        | term '!'
-        | NUMBER
-        ;
+term:
+  '(' expr ')'
+| term '!'
+| NUMBER
+;
 @end group
 @end example
 
@@ -6402,9 +6429,9 @@ statements, with a pair of rules like this:
 @example
 @group
 if_stmt:
-          IF expr THEN stmt
-        | IF expr THEN stmt ELSE stmt
-        ;
+  IF expr THEN stmt
+| IF expr THEN stmt ELSE stmt
+;
 @end group
 @end example
 
@@ -6471,20 +6498,22 @@ the conflict:
 %%
 @end group
 @group
-stmt:     expr
-        | if_stmt
-        ;
+stmt:
+  expr
+| if_stmt
+;
 @end group
 
 @group
 if_stmt:
-          IF expr THEN stmt
-        | IF expr THEN stmt ELSE stmt
-        ;
+  IF expr THEN stmt
+| IF expr THEN stmt ELSE stmt
+;
 @end group
 
-expr:     variable
-        ;
+expr:
+  variable
+;
 @end example
 
 @node Precedence
@@ -6512,12 +6541,13 @@ input @w{@samp{1 - 2 * 3}} can be parsed in two different ways):
 
 @example
 @group
-expr:     expr '-' expr
-        | expr '*' expr
-        | expr '<' expr
-        | '(' expr ')'
-        @dots{}
-        ;
+expr:
+  expr '-' expr
+| expr '*' expr
+| expr '<' expr
+| '(' expr ')'
+@dots{}
+;
 @end group
 @end example
 
@@ -6671,10 +6701,11 @@ Now the precedence of @code{UMINUS} can be used in specific rules:
 
 @example
 @group
-exp:    @dots{}
-        | exp '-' exp
-        @dots{}
-        | '-' exp %prec UMINUS
+exp:
+  @dots{}
+| exp '-' exp
+  @dots{}
+| '-' exp %prec UMINUS
 @end group
 @end example
 
@@ -6740,20 +6771,18 @@ of zero or more @code{word} groupings.
 
 @example
 @group
-sequence: /* empty */
-                @{ printf ("empty sequence\n"); @}
-        | maybeword
-        | sequence word
-                @{ printf ("added word %s\n", $2); @}
-        ;
+sequence:
+  /* empty */    @{ printf ("empty sequence\n"); @}
+| maybeword
+| sequence word  @{ printf ("added word %s\n", $2); @}
+;
 @end group
 
 @group
-maybeword: /* empty */
-                @{ printf ("empty maybeword\n"); @}
-        | word
-                @{ printf ("single word %s\n", $1); @}
-        ;
+maybeword:
+  /* empty */   @{ printf ("empty maybeword\n"); @}
+| word          @{ printf ("single word %s\n", $1); @}
+;
 @end group
 @end example
 
@@ -6781,28 +6810,30 @@ reduce/reduce conflict must be studied and usually eliminated.  Here is the
 proper way to define @code{sequence}:
 
 @example
-sequence: /* empty */
-                @{ printf ("empty sequence\n"); @}
-        | sequence word
-                @{ printf ("added word %s\n", $2); @}
-        ;
+sequence:
+  /* empty */    @{ printf ("empty sequence\n"); @}
+| sequence word  @{ printf ("added word %s\n", $2); @}
+;
 @end example
 
 Here is another common error that yields a reduce/reduce conflict:
 
 @example
-sequence: /* empty */
-        | sequence words
-        | sequence redirects
-        ;
+sequence:
+  /* empty */
+| sequence words
+| sequence redirects
+;
 
-words:    /* empty */
-        | words word
-        ;
+words:
+  /* empty */
+| words word
+;
 
-redirects:/* empty */
-        | redirects redirect
-        ;
+redirects:
+  /* empty */
+| redirects redirect
+;
 @end example
 
 @noindent
@@ -6821,10 +6852,11 @@ Here are two ways to correct these rules.  First, to make it a single level
 of sequence:
 
 @example
-sequence: /* empty */
-        | sequence word
-        | sequence redirect
-        ;
+sequence:
+  /* empty */
+| sequence word
+| sequence redirect
+;
 @end example
 
 Second, to prevent either a @code{words} or a @code{redirects}
@@ -6832,22 +6864,25 @@ from being empty:
 
 @example
 @group
-sequence: /* empty */
-        | sequence words
-        | sequence redirects
-        ;
+sequence:
+  /* empty */
+| sequence words
+| sequence redirects
+;
 @end group
 
 @group
-words:    word
-        | words word
-        ;
+words:
+  word
+| words word
+;
 @end group
 
 @group
-redirects:redirect
-        | redirects redirect
-        ;
+redirects:
+  redirect
+| redirects redirect
+;
 @end group
 @end example
 
@@ -6863,30 +6898,27 @@ Here is an example:
 %token ID
 
 %%
-def:    param_spec return_spec ','
-        ;
+def: param_spec return_spec ',';
 param_spec:
-             type
-        |    name_list ':' type
-        ;
+  type
+| name_list ':' type
+;
 @end group
 @group
 return_spec:
-             type
-        |    name ':' type
-        ;
+  type
+| name ':' type
+;
 @end group
 @group
-type:        ID
-        ;
+type: ID;
 @end group
 @group
-name:        ID
-        ;
+name: ID;
 name_list:
-             name
-        |    name ',' name_list
-        ;
+  name
+| name ',' name_list
+;
 @end group
 @end example
 
@@ -6935,11 +6967,10 @@ distinct.  In the above example, adding one rule to
 %%
 @dots{}
 return_spec:
-             type
-        |    name ':' type
-        /* This rule is never used.  */
-        |    ID BOGUS
-        ;
+  type
+| name ':' type
+| ID BOGUS       /* This rule is never used.  */
+;
 @end group
 @end example
 
@@ -6959,13 +6990,13 @@ rather than the one for @code{name}.
 
 @example
 param_spec:
-             type
-        |    name_list ':' type
-        ;
+  type
+| name_list ':' type
+;
 return_spec:
-             type
-        |    ID ':' type
-        ;
+  type
+| ID ':' type
+;
 @end example
 
 For a more detailed exposition of LALR(1) parsers and parser
@@ -7325,7 +7356,7 @@ semantic actions, but none of these are performed during the exploratory
 parse.  Finally, the base of the temporary stack used during an exploratory
 parse is a pointer into the normal parser state stack so that the stack is
 never physically copied.  In our experience, the performance penalty of LAC
-has proven insignificant for practical grammars.
+has proved insignificant for practical grammars.
 @end itemize
 
 While the LAC algorithm shares techniques that have been recognized in the
@@ -7540,20 +7571,21 @@ in the current context, the parse can continue.
 For example:
 
 @example
-stmnts:  /* empty string */
-        | stmnts '\n'
-        | stmnts exp '\n'
-        | stmnts error '\n'
+stmts:
+  /* empty string */
+| stmts '\n'
+| stmts exp '\n'
+| stmts error '\n'
 @end example
 
 The fourth rule in this example says that an error followed by a newline
-makes a valid addition to any @code{stmnts}.
+makes a valid addition to any @code{stmts}.
 
 What happens if a syntax error occurs in the middle of an @code{exp}?  The
 error recovery rule, interpreted strictly, applies to the precise sequence
-of a @code{stmnts}, an @code{error} and a newline.  If an error occurs in
+of a @code{stmts}, an @code{error} and a newline.  If an error occurs in
 the middle of an @code{exp}, there will probably be some additional tokens
-and subexpressions on the stack after the last @code{stmnts}, and there
+and subexpressions on the stack after the last @code{stmts}, and there
 will be tokens to read before the next newline.  So the rule is not
 applicable in the ordinary way.
 
@@ -7561,7 +7593,7 @@ But Bison can force the situation to fit the rule, by discarding part of
 the semantic context and part of the input.  First it discards states
 and objects from the stack until it gets back to a state in which the
 @code{error} token is acceptable.  (This means that the subexpressions
-already parsed are discarded, back to the last complete @code{stmnts}.)
+already parsed are discarded, back to the last complete @code{stmts}.)
 At this point the @code{error} token can be shifted.  Then, if the old
 lookahead token is not acceptable to be shifted next, the parser reads
 tokens and discards them until it finds a token which is acceptable.  In
@@ -7575,7 +7607,7 @@ error recovery.  A simple and useful strategy is simply to skip the rest of
 the current input line or current statement if an error is detected:
 
 @example
-stmnt: error ';'  /* On error, skip until ';' is read.  */
+stmt: error ';'  /* On error, skip until ';' is read.  */
 @end example
 
 It is also useful to recover to the matching close-delimiter of an
@@ -7584,20 +7616,21 @@ close-delimiter will probably appear to be unmatched, and generate another,
 spurious error message:
 
 @example
-primary:  '(' expr ')'
-        | '(' error ')'
-        @dots{}
-        ;
+primary:
+  '(' expr ')'
+| '(' error ')'
+@dots{}
+;
 @end example
 
 Error recovery strategies are necessarily guesses.  When they guess wrong,
 one syntax error often leads to another.  In the above example, the error
 recovery rule guesses that an error is due to bad input within one
-@code{stmnt}.  Suppose that instead a spurious semicolon is inserted in the
-middle of a valid @code{stmnt}.  After the error recovery rule recovers
+@code{stmt}.  Suppose that instead a spurious semicolon is inserted in the
+middle of a valid @code{stmt}.  After the error recovery rule recovers
 from the first error, another syntax error will be found straightaway,
 since the text following the spurious semicolon is also an invalid
-@code{stmnt}.
+@code{stmt}.
 
 To prevent an outpouring of error messages, the parser will output no error
 message for another syntax error that happens shortly after the first; only
@@ -7709,18 +7742,16 @@ duplication, with actions omitted for brevity:
 @example
 @group
 initdcl:
-          declarator maybeasm '='
-          init
-        | declarator maybeasm
-        ;
+  declarator maybeasm '=' init
+| declarator maybeasm
+;
 @end group
 
 @group
 notype_initdcl:
-          notype_declarator maybeasm '='
-          init
-        | notype_declarator maybeasm
-        ;
+  notype_declarator maybeasm '=' init
+| notype_declarator maybeasm
+;
 @end group
 @end example
 
@@ -7761,24 +7792,21 @@ as an identifier if it appears in that context.  Here is how you can do it:
 @dots{}
 @end group
 @group
-expr:   IDENTIFIER
-        | constant
-        | HEX '('
-                @{ hexflag = 1; @}
-          expr ')'
-                @{ hexflag = 0;
-                   $$ = $4; @}
-        | expr '+' expr
-                @{ $$ = make_sum ($1, $3); @}
-        @dots{}
-        ;
+expr:
+  IDENTIFIER
+| constant
+| HEX '('        @{ hexflag = 1; @}
+    expr ')'     @{ hexflag = 0; $$ = $4; @}
+| expr '+' expr  @{ $$ = make_sum ($1, $3); @}
+@dots{}
+;
 @end group
 
 @group
 constant:
-          INTEGER
-        | STRING
-        ;
+  INTEGER
+| STRING
+;
 @end group
 @end example
 
@@ -7804,12 +7832,12 @@ For example, in C-like languages, a typical error recovery rule is to skip
 tokens until the next semicolon, and then start a new statement, like this:
 
 @example
-stmt:   expr ';'
-        | IF '(' expr ')' stmt @{ @dots{} @}
-        @dots{}
-        error ';'
-                @{ hexflag = 0; @}
-        ;
+stmt:
+  expr ';'
+| IF '(' expr ')' stmt @{ @dots{} @}
+@dots{}
+| error ';'  @{ hexflag = 0; @}
+;
 @end example
 
 If there is a syntax error in the middle of a @samp{hex (@var{expr})}
@@ -7826,11 +7854,11 @@ and skips to the close-parenthesis:
 
 @example
 @group
-expr:   @dots{}
-        | '(' expr ')'
-                @{ $$ = $2; @}
-        | '(' error ')'
-        @dots{}
+expr:
+  @dots{}
+| '(' expr ')'   @{ $$ = $2; @}
+| '(' error ')'
+@dots{}
 @end group
 @end example
 
@@ -7888,12 +7916,13 @@ The following grammar file, @file{calc.y}, will be used in the sequel:
 %left '+' '-'
 %left '*'
 %%
-exp: exp '+' exp
-   | exp '-' exp
-   | exp '*' exp
-   | exp '/' exp
-   | NUM
-   ;
+exp:
+  exp '+' exp
+| exp '-' exp
+| exp '*' exp
+| exp '/' exp
+| NUM
+;
 useless: STR;
 %%
 @end example
@@ -8507,7 +8536,7 @@ Also warn about mid-rule values that are used but not set.
 For example, warn about unset @code{$$} in the mid-rule action in:
 
 @example
- exp: '1' @{ $1 = 1; @} '+' exp @{ $$ = $2 + $4; @};
+exp: '1' @{ $1 = 1; @} '+' exp @{ $$ = $2 + $4; @};
 @end example
 
 These warnings are not enabled by default since they sometimes prove to
@@ -9302,8 +9331,9 @@ The grammar itself is straightforward.
 %start unit;
 unit: assignments exp  @{ driver.result = $2; @};
 
-assignments: assignments assignment @{@}
-           | /* Nothing.  */        @{@};
+assignments:
+  /* Nothing.  */        @{@}
+| assignments assignment @{@};
 
 assignment:
      "identifier" ":=" exp
@@ -10313,8 +10343,9 @@ real start-symbol:
 @example
 %token START_FOO START_BAR;
 %start start;
-start: START_FOO foo
-     | START_BAR bar;
+start:
+  START_FOO foo
+| START_BAR bar;
 @end example
 
 These tokens prevents the introduction of new conflicts.  As far as the
@@ -11248,7 +11279,7 @@ London, Department of Computer Science, TR-00-12 (December 2000).
 @c LocalWords: NUM exp subsubsection kbd Ctrl ctype EOF getchar isdigit nonfree
 @c LocalWords: ungetc stdin scanf sc calc ulator ls lm cc NEG prec yyerrok rr
 @c LocalWords: longjmp fprintf stderr yylloc YYLTYPE cos ln Stallman Destructor
-@c LocalWords: symrec val tptr FNCT fnctptr func struct sym enum
+@c LocalWords: symrec val tptr FNCT fnctptr func struct sym enum IEC syntaxes
 @c LocalWords: fnct putsym getsym fname arith fncts atan ptr malloc sizeof Lex
 @c LocalWords: strlen strcpy fctn strcmp isalpha symbuf realloc isalnum DOTDOT
 @c LocalWords: ptypes itype YYPRINT trigraphs yytname expseq vindex dtype Unary
@@ -11258,35 +11289,36 @@ London, Department of Computer Science, TR-00-12 (December 2000).
 @c LocalWords: strncmp intval tindex lvalp locp llocp typealt YYBACKUP subrange
 @c LocalWords: YYEMPTY YYEOF YYRECOVERING yyclearin GE def UMINUS maybeword loc
 @c LocalWords: Johnstone Shamsa Sadaf Hussain Tomita TR uref YYMAXDEPTH inline
-@c LocalWords: YYINITDEPTH stmnts ref stmnt initdcl maybeasm notype Lookahead
+@c LocalWords: YYINITDEPTH stmts ref initdcl maybeasm notype Lookahead yyoutput
 @c LocalWords: hexflag STR exdent itemset asis DYYDEBUG YYFPRINTF args Autoconf
 @c LocalWords: infile ypp yxx outfile itemx tex leaderfill Troubleshouting sqrt
 @c LocalWords: hbox hss hfill tt ly yyin fopen fclose ofirst gcc ll lookahead
 @c LocalWords: nbar yytext fst snd osplit ntwo strdup AST Troublereporting th
 @c LocalWords: YYSTACK DVI fdl printindex IELR nondeterministic nonterminals ps
 @c LocalWords: subexpressions declarator nondeferred config libintl postfix LAC
-@c LocalWords: preprocessor nonpositive unary nonnumeric typedef extern rhs
-@c LocalWords: yytokentype destructor multicharacter nonnull EBCDIC
+@c LocalWords: preprocessor nonpositive unary nonnumeric typedef extern rhs sr
+@c LocalWords: yytokentype destructor multicharacter nonnull EBCDIC nterm LR's
 @c LocalWords: lvalue nonnegative XNUM CHR chr TAGLESS tagless stdout api TOK
-@c LocalWords: destructors Reentrancy nonreentrant subgrammar nonassociative
+@c LocalWords: destructors Reentrancy nonreentrant subgrammar nonassociative Ph
 @c LocalWords: deffnx namespace xml goto lalr ielr runtime lex yacc yyps env
 @c LocalWords: yystate variadic Unshift NLS gettext po UTF Automake LOCALEDIR
 @c LocalWords: YYENABLE bindtextdomain Makefile DEFS CPPFLAGS DBISON DeRemer
-@c LocalWords: autoreconf Pennello multisets nondeterminism Generalised baz
+@c LocalWords: autoreconf Pennello multisets nondeterminism Generalised baz ACM
 @c LocalWords: redeclare automata Dparse localedir datadir XSLT midrule Wno
-@c LocalWords: Graphviz multitable headitem hh basename Doxygen fno
+@c LocalWords: Graphviz multitable headitem hh basename Doxygen fno filename
 @c LocalWords: doxygen ival sval deftypemethod deallocate pos deftypemethodx
 @c LocalWords: Ctor defcv defcvx arg accessors arithmetics CPP ifndef CALCXX
 @c LocalWords: lexer's calcxx bool LPAREN RPAREN deallocation cerrno climits
 @c LocalWords: cstdlib Debian undef yywrap unput noyywrap nounput zA yyleng
-@c LocalWords: errno strtol ERANGE str strerror iostream argc argv Javadoc
+@c LocalWords: errno strtol ERANGE str strerror iostream argc argv Javadoc PSLR
 @c LocalWords: bytecode initializers superclass stype ASTNode autoboxing nls
 @c LocalWords: toString deftypeivar deftypeivarx deftypeop YYParser strictfp
 @c LocalWords: superclasses boolean getErrorVerbose setErrorVerbose deftypecv
 @c LocalWords: getDebugStream setDebugStream getDebugLevel setDebugLevel url
 @c LocalWords: bisonVersion deftypecvx bisonSkeleton getStartPos getEndPos
-@c LocalWords: getLVal defvar deftypefn deftypefnx gotos msgfmt Corbett
-@c LocalWords: subdirectory Solaris nonassociativity
+@c LocalWords: getLVal defvar deftypefn deftypefnx gotos msgfmt Corbett LALR's
+@c LocalWords: subdirectory Solaris nonassociativity perror schemas Malloy
+@c LocalWords: Scannerless ispell american
 
 @c Local Variables:
 @c ispell-dictionary: "american"