Click here to Skip to main content
15,442,338 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
#include ""
char nom[];
chiffre [0-9]
lettre [A-Za-z]
entier (-)?{chiffre}{chiffre}*
reel {entier}.{chiffre}*((e|E) {entier})?
identifiant {lettre}({lettre}|{chiffre})*

/*on va passer à la partie regles de traduction*/

{entier} {ECHO;valEntier=atoi(yytext);return entier;}
{reel}   {ECHO;valReel=atof(yytext);return reel;}
do {ECHO; return do;}
while {ECHO; return while;}
{identifiant} {ECHO; strcpy(nom, yytext); return identificateur;}
"==" {ECHO; return egal;}
"!=" {ECHO;  return notegal;}
"<" {ECHO; return inf;}
">" {ECHO; return sup;}
"=" {ECHO; return AFFECT;}
"+" {ECHO; return plus;}
"-" {ECHO; return moins;}
"*" {ECHO; return fois;}
"/" {ECHO; return div;}
int yywrap()
{return 1;

What I have tried:

{reel}   {ECHO;valReel=atof(yytext);return reel;}
in this line i tried to replace atof with atoi but it doesn't change anything; and i tried also to put a * instead of ? on this line at the end "
reel {entier}.{chiffre}*((e|E) {entier})?
" but it seems not to be working; pls hlp
Updated 31-May-21 5:13am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900