Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  calculator.y
Language: C/C++
Code:
%{
%union
{
int dval;
}
%token <dval> DIGIT
%type <dval> expr
%type <dval> expr1
%%
line: expr '\n' {printf("%d\n",$1);}
;
expr : expr'+' expr1 {$$=$1+$3;}
;
expr1:'9'expr'0' {$$=$2;}
| DIGIT
;
%%
Comments: