tp-langages-formels/syntaxique/langlex.l

34 lines
537 B
Plaintext

%option noyywrap
DIG [0-9]
%%
"bool" { return BOOL; }
"while" { return WHILE; }
"do" { return DO; }
"od" { return OD; }
"if" { return IF; }
"then" { return THEN; }
"fi" { return FI; }
"else" { return ELSE; }
"print" { return PRINT; }
"true" { return TRUE; }
"false" { return FALSE; }
":=" { return ASSIGN; }
"^" { return XOR; }
"||" { return OR; }
"&&" { return AND; }
"!" { return NOT; }
"<=>" { return EQUIV; }
[a-z_][a-z0-9_]* { yylval.i = strdup(yytext); return IDENT; }
[ \n] { /* ignore */ }
. { return *yytext; }
%%