Logo AND Algorithmique Numérique Distribuée

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