2 pièce(s) jointe(s)
problem d'un programme lex
Bonjour,
J'ai cet probleme dans un programme lex
Pièce jointe 163148
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| %option noyywrap
lettre [A-Za-z]
chiffre [0-9]
mot_clé "prog"|"var"|"int"|"func"|"proc"|"begin"|"if"|"then"|"else"|"while"|"do"|"opaffect"|"oprel"|"opadd"|"opmul"|"nb"|"not"
identificateur {lettre}(_|{lettre}|{chiffre})*
nb {chiffre}{chiffre}*
oprel "=="|"<>"|"<"|">"|"<="|">="
opadd "+"|"-"|"or"
opmul "*"|"/"|"div"|"mod"
opaffect "="
%%
{identificateur} { printf ("id");}
{nb} { printf ("nb");}
{mot_clé } { printf ("mot_clé");}
{oprel} { printf ("oprel");}
{opadd} { printf ("opadd");}
{opmul} { printf ("opmul");}
{opaffect} { printf ("opaffect");}
%%
main() {
yylex();
} |