Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Various cleanups to the model-checking user interface
[simgrid.git] / src / xbt / automaton / parserPromela.yacc
1 %{
2
3 #include "automaton_lexer.yy.c"
4 #include <xbt/automaton.h>
5
6 void yyerror(const char *s);
7
8 %}
9
10 %union{
11   double real;
12   int integer;
13   char* string;
14   xbt_exp_label_t label;
15 }
16
17 %token NEVER
18 %token IF
19 %token FI
20 %token IMPLIES
21 %token GOTO
22 %token AND
23 %token OR
24 %token NOT
25 %token LEFT_PAR
26 %token RIGHT_PAR
27 %token CASE
28 %token COLON
29 %token SEMI_COLON
30 %token CASE_TRUE
31 %token LEFT_BRACE
32 %token RIGHT_BRACE
33 %token <integer> LITT_ENT
34 %token <string> LITT_CHAINE
35 %token <real> LITT_REEL
36 %token <string> ID
37
38 %type <label> exp;
39
40 %start automaton
41
42 %left AND OR
43 %nonassoc NOT
44
45 %%
46
47 automaton : NEVER LEFT_BRACE stateseq RIGHT_BRACE 
48           ;
49
50 stateseq : 
51          | ID COLON { new_state($1, 1);} IF option FI SEMI_COLON stateseq 
52          ;
53
54 option :
55        | CASE exp IMPLIES GOTO ID option { new_transition($5, $2);}
56        ;
57
58 exp : LEFT_PAR exp RIGHT_PAR { $$ = $2; }
59     | exp OR exp { $$ = new_label(0, $1, $3); }
60     | exp AND exp { $$ = new_label(1, $1, $3); }
61     | NOT exp { $$ = new_label(2, $2); }
62     | CASE_TRUE { $$ = new_label(4); }
63     | ID { $$ = new_label(3, $1); }
64     ;
65  
66 %%
67
68
69
70 void yyerror(const char *s){
71   fprintf (stderr, "%s\n", s);
72 }
73
74
75