I redeem this problem with the flex and bison compilation. this image: https://drive.google.com/open?id=1o_XSlpBV3FaQJn9AlBGrkBDqnWJOyCjR shows which commands I run and what I get in output. I am a beginner for this type of programming and I can not understand what the problem is. my codes are as follows:
BISON CODE
%{
/#include <stdio.h>
%}
%token NUM PIU MENO PER DIVISO PAR_AP PAR_CH
%start Expr
%error-verbose
%%
Expr: Expr PIU Term
| Expr MENO Term
| Term
;
Term: Term PER Factor
| Term DIVISO Factor
| Factor
;
Factor: NUM
| PAR_AP Expr PAR_CH
;
%%
int main (void) {
yyparse();
return 0;
}
yyerror (char *s) {
printf("Errore Sintattico\n");
}
FLEX CODE
%{
/#include <stdio.h>
/#include "prova.tab.h"
%}
delim [ \t\n]
ws {delim}+
digit [0-9]
number {digit}+
%option noyywrap
%%
{ws} ;
{number} {return (NUM);}
\+ {return(PIU);}
\- {return (MENO);}
\* {return (PER);}
[/] {return (DIVISO);}
\( {return (PAR_AP);}
\) {return (PAR_CH);}
%%