%{
#include <stdio.h>
#define YYSTYPE double
%}
%token Constant 300
%token '+' '-' '*' '/' '(' ')' 
%left  '+' '-'
%left  '*' '/'
%%
line		: line expression '\n' {printf("%f\n",$2);}
		| /* empty string */
		;
expression	: expression '+' expression {$$ = $1 + $3;}
                | expression '-' expression {$$ = $1 - $3;}
                | expression '*' expression {$$ = $1 * $3;}
                | expression '/' expression {$$ = $1 / $3;}
		| '(' expression ')' {$$ = $2;}
		| Constant  /* $$ = $1 */
		;
%%
main()
{
#ifdef YYDEBUG
	extern int yydebug;
	yydebug = 1;
#endif
	printf("yyparse() == %d\n", yyparse());
}

yyerror(s)
char *s;
{
	fprintf(stderr, "%s\n", s);
}
