tp-langages-formels/syntaxique/langlex.l

34 lines
537 B
Plaintext
Raw Normal View History

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