/* file name : list3.y */ /* left associative production demonstration */ %{ #define YYSTYPE double %} %token NUMBER %left ',' %% input : list '\n' | input list ; list : list ',' list | NUMBER { printf ("\t= %.2f\n", $1); } ; %% main () { yyparse (); } yyerror (char *s) /* Called by yyparse on error */ { printf ("\terror: %s\n", s); }