/[bison]/bison/tests/calc.at
ViewVC logotype

Diff of /bison/tests/calc.at

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

revision 1.25 by akim, Thu Jun 20 09:08:37 2002 UTC revision 1.26 by akim, Sun Jun 30 17:27:14 2002 UTC
# Line 67  typedef int value_t; Line 67  typedef int value_t;
67    
68  %}  %}
69    
70  /* Exercise M4 quoting: '@:>@@:>@', 0.  */  /* Exercise %union. */
   
 /* Also exercise %union. */  
71  %union  %union
72  {  {
73    value_t ival; /* A comment to exercise an old bug. */    value_t ival;
74  };  };
75    
 /* Exercise post-prologue dependency to %union.  */  
 %{  
 static void id (YYSTYPE *lval);  
   
 /* Exercise quotes in declarations.  */  
 char quote[] = "@:>@@:>@,";  
 %}  
   
76  /* Bison Declarations */  /* Bison Declarations */
77  %token CALC_EOF 0 "end of file"  %token CALC_EOF 0 "end of file"
78  %token <ival> NUM "number"  %token <ival> NUM "number"
79  %type  <ival> exp  %type  <ival> exp
80    
 /* Exercise quotes in strings.  */  
 %token FAKE "fake @>:@@>:@,"  
   
81  %nonassoc '=' /* comparison            */  %nonassoc '=' /* comparison            */
82  %left '-' '+'  %left '-' '+'
83  %left '*' '/'  %left '*' '/'
# Line 107  input: Line 94  input:
94  ;  ;
95    
96  line:  line:
97    '\n'    '\n'      {}
98  | exp '\n'  | exp '\n'  {}
   {  
     /* Exercise quotes in braces.  */  
     char tmp[] = "@>:@@:>@,";  
   }  
99  ;  ;
100    
 /* Exercise M4 quoting: '@:>@@:>@', 1.  */  
101  exp:  exp:
102    NUM                { $$ = $1;             }    NUM                { $$ = $1;             }
103  | exp '=' exp  | exp '=' exp
# Line 137  exp: Line 119  exp:
119  /* The input. */  /* The input. */
120  FILE *yyin;  FILE *yyin;
121    
 /* Exercise M4 quoting: '@:>@@:>@', 2.  */  
122  static void  static void
123  yyerror (const char *s)  yyerror (const char *s)
124  {  {
# Line 259  power (int base, int exponent) Line 240  power (int base, int exponent)
240    return res;    return res;
241  }  }
242    
 void  
 id (YYSTYPE* lval)  
 {  
 }  
   
243  int  int
244  main (int argc, const char **argv)  main (int argc, const char **argv)
245  {  {

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26

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