-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlexical.l
More file actions
71 lines (63 loc) · 1.42 KB
/
lexical.l
File metadata and controls
71 lines (63 loc) · 1.42 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
%{
#include "synt.tab.h"
//#include "Table.h"
#include <stdio.h>
#include <string.h>
extern int nb_ligne;
extern char sauvFct[15];
extern YYSTYPE yylval;
%}
%option yylineno
lettre [a-zA-Z]
chiffre [0-9]
IDF {lettre}({lettre}|{chiffre}|_)*
IDFCmntr [^"*/"]*
IDFTxt [^"""]*
cst [+-]?{chiffre}+
IDFFONC {lettre}({lettre}|{chiffre}|_){1,11}
%%
ALGORITHME return algo;
DEBUT return deb;
FIN return fin;
VAR return var;
\/\*{IDFCmntr}\*\/
\"{IDFTxt}\" return Str;
entier {yylval.str=strdup(yytext); return entier;}
reel {yylval.str=strdup(yytext); return reel;}
chaine {yylval.str=strdup(yytext); return chaine;}
Tanque" "*\( return tanq;
Faire return Faire;
Fait return Fait;
: return dp;
\. return vg;
$$include return include;
InOut return InOut;
Arithme return Arithme;
\>\n {nb_ligne++; return F;}
\( return oprt;
\) return cprt;
\> return great;
\>= return greatEql;
\< return infr;
\<= return infrEql;
\= return equal;
\!= return notEqual;
ECRIRE" "*\( return Ecrire;
LIRE return Lire;
RETURN return Return;
\" return guil;
\n nb_ligne++;
FONCTION" "*{IDFFONC} {yylval.str=strdup(yytext); insererFct(yytext); return idfFonc;}
\[ return obrk;
\] return cbrk;
CONST return mc_const;
{IDF} {yylval.str=strdup(yytext); return idf;}
{cst} {yylval.entier=atoi(yytext); return cst;}
:= return aff;
# return pvg;
\+ return plus;
\- return minus;
\* return mult;
\/ return dive;
[ \t]
. printf("erreur lexicale a la ligne %d \n",nb_ligne) ;