Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : bugged2_liveness with promela of LTL properties checked
[simgrid.git] / examples / msg / mc / parserPromela.lex
1 %option noyywrap
2
3 %{
4
5
6 #include <stdio.h>
7 #include "automaton.h"
8 #include "y.tab.h"
9   
10   extern YYSTYPE yylval;
11  
12 %}
13
14 blancs       [ \t]+
15 espace       [ ]+
16 nouv_ligne   [ \n]
17
18 chiffre      [0-9]
19 entier       {chiffre}+
20 reel         {entier}("."{entier})
21 caractere    [a-zA-Z0-9_]
22
23 numl         \n
24
25 chaine       \"({caractere}*|\n|\\|\"|{espace}*)*\"
26
27 commentaire  "/*"([^\*\/]*{nouv_ligne}*[^\*\/]*)*"*/"
28
29 %%
30
31 "never"      { printf("%s", yytext); return (NEVER); }
32 "if"         { printf("%s", yytext); return (IF); }
33 "fi"         { printf("%s", yytext); 
34                return (FI); }
35 "->"         { printf("%s", yytext); return (IMPLIES); }
36 "goto"       { printf("%s", yytext); return (GOTO); }
37 "&&"         { printf("%s", yytext); return (AND); }
38 "||"         { printf("%s", yytext); return (OR); }
39 "!"          { printf("%s", yytext); return (NOT); }
40 "("          { printf("%s", yytext); return (LEFT_PAR); }
41 ")"          { printf("%s", yytext); return (RIGHT_PAR); }
42 "::"         { printf("%s", yytext); return (CASE); }
43 ":"          { printf("%s", yytext); return (COLON); }
44 ";"          { printf("%s", yytext); return (SEMI_COLON); }
45 "1"          { printf("%s", yytext); return (CASE_TRUE); }
46 "{"          { printf("%s", yytext); return (LEFT_BRACE); }
47 "}"          { printf("%s", yytext); return (RIGHT_BRACE); }
48
49
50 {commentaire}             { printf(" ");}
51
52 {blancs}                  { printf("%s",yytext); }
53
54
55 {reel}                    { printf("%s",yytext); 
56                             sscanf(yytext,"%lf",&yylval.real); 
57                             return (LITT_REEL); }
58
59 {entier}                  { printf("%s",yytext); 
60                             sscanf(yytext,"%d",&yylval.integer); 
61                             return (LITT_ENT); }
62
63 {chaine}                  { printf("%s",yytext);  
64                             yylval.string=(char *)malloc(strlen(yytext)+1);
65                             sscanf(yytext,"%s",yylval.string); 
66                             return (LITT_CHAINE); }
67
68 [a-zA-Z]{caractere}*      { printf("%s",yytext); 
69                             yylval.string=(char *)malloc(strlen(yytext)+1);
70                             sscanf(yytext,"%s",yylval.string);
71                             return (ID); }
72                    
73 {numl}                    { printf("\n"); }
74
75 .                         { printf("caractère inconnu\n"); }
76
77 %%
78
79