execparser.opp.exp 25.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624
File "execparser.mly", line 89, characters 16-21:
Warning: the token CHECK is unused.
File "execparser.mly", line 88, characters 16-20:
Warning: the token EDGE is unused.
File "execparser.mly", line 109, characters 19-22:
Warning: the token FIG is unused.
File "execparser.mly", line 109, characters 26-30:
Warning: the token INIT is unused.
File "execparser.mly", line 109, characters 8-12:
Warning: the token MODE is unused.
File "execparser.mly", line 109, characters 13-18:
Warning: the token NEATO is unused.
File "execparser.mly", line 131, characters 13-16:
Warning: the token NUM is unused.
File "execparser.mly", line 109, characters 31-34:
Warning: the token PAR is unused.
File "execparser.mly", line 109, characters 23-25:
Warning: the token PS is unused.
File "execparser.mly", line 109, characters 39-42:
Warning: the token TXT is unused.
File "execparser.mly", line 115, characters 8-18:
Warning: the token WHITESPACE is unused.
%{
open Globals
open Location
open Types
open Auxl
open Value
open Ids

let mkl () = 
   [ { Location.loc_start = symbol_start_pos ();  
       Location.loc_end = symbol_end_pos () } ]

let mkp () = 
   symbol_start_pos ()

(* let mkl x =  *)
(*   let l = {Location.loc_start=symbol_start_pos ();  *)
(* 	   Location.loc_end=symbol_end_pos ()} in *)
(*   (\* print_string (Location.pp_t l) ; flush stdout; *\)  *)
(*   {desc=x; loc=l} *)
    
let parse_error s = 
  raise (My_parse_error ("Parse error: " ^ s ^ " " 
	   ^ Location.pp_position2 (Parsing.symbol_end_pos () )))




(* %token EQUAL             *)
%}
%start execfile
%start instructions
%start skeletonexecfile
%token YSCALE
%token XSCALE
%token WSKEL
%token WHITESPACE
%token <Types.order_type> W
%token U
%token TXT
%token TO
%token THREAD_IDS
%token TEX
%token SUPPRESS_EDGE
%token SUPPRESS_ACTION
%token <string> STRING
%token STAR
%token SLASH
%token SHOW
%token SET
%token SEMICOLON
%token SAMELOC
%token RSKEL
%token RMWSKEL
%token <Types.order_type> RMW
%token REMOVE
%token RELABEL
%token RBRACE
%token RANKSEP
%token <Types.order_type> R
%token QUIT
%token PS
%token PENWIDTH
%token PAR
%token <int> NUM
%token NONSTOP
%token NONATOMIC
%token NODE_WIDTH
%token NODE_HEIGHT
%token NODESEP
%token NEXTCONSISTENT
%token NEXTCANDIDATE
%token NEXT
%token NEATO_PAR_INIT
%token NEATO_PAR
%token NEATO_DOWNWARDS
%token NEATO
%token MUTEX
%token MODEL
%token MODE
%token <Types.order_type> MO
%token <Cmm.lock_outcome> LOCKOUTCOME
%token LOCATION_KINDS
%token LEGEND
%token LBRACE
%token LAYOUT
%token L
%token ISAFILE
%token INTERMEDIATE
%token INSTRFILE
%token INIT
%token IGNORE
%token <string> IDENT
%token HELP
%token GENERATE
%token FSKEL
%token FROM
%token FONTSIZE
%token FILLED
%token <string> FILENAME
%token FIG
%token <Types.order_type> F
%token EXCFILE
%token EQUALS
%token EOF
%token EDGETAIL
%token EDGEHEAD
%token <string> EDGE
%token DOTFILE
%token DOT
%token DISPLAY_EDGE
%token DISPLAY_ACTION
%token CONSIDER
%token COMMA
%token COLON
%token <string> CHECK
%token <bool> BOOL
%token ATOMICLOCS
%token ATOMIC
%token ALL
%token ADD

%type <Cmm.action> action
%type <Types.execfileitem list> execfile
%type <Types.raw_instructions> instructions
%type <Types.skeletonexecfileitem list> skeletonexecfile
%%

execfile:
| _1 = items
    {         ( _1 )}

instructions:
| _1 = EOF
    {                                  ( empty_raw_instructions )}
| _1 = instruction
    {                                  ( _1 )}
| _1 = instruction _2 = DOT
    {                                  ( _1 )}
| _1 = instruction _2 = DOT _3 = instructions
    {                                  ( add_raw_instructions _1 _3 )}

instruction:
| _1 = command
    {                               ( {empty_raw_instructions with 
				     raw_commands = [_1]} )}
| _1 = SHOW _2 = IDENT
    {                                    ( let i = 
                                            try int_of_string _2 
                                            with Failure "int_of_string" -> parse_error ("Show expects a number, not " ^ _2) in 
                                         {empty_raw_instructions with raw_show = Some i;} )}
| _1 = SHOW _2 = ALL
    {                                     ( {empty_raw_instructions with raw_show = None;} )}
| _1 = CONSIDER _2 = transition_sequence
    {                                 ( let rel =
                                           let (start,ts) = _2 in
                                           match ts with
                                           | [] -> parse_error "not considering blank constraint"
                                           | (e,_) :: _ ->
                                               (e,List.map (fun (_,fin) -> (start,fin)) ts)
                                   in
                                   {empty_raw_instructions with
                                    raw_constrain_rels = 
                                    [ConsiderRel rel];} )}
| _1 = CONSIDER _2 = prefixed_transition_sequence
    {                                          ( let rel =
                                           let (start,ts) = _2 in
                                           match ts with
                                           | [] -> parse_error "not considering blank constraint"
                                           | (e,_) :: _ ->
                                               (e,List.map (fun (_,fin) -> (start,fin)) ts)
                                   in
                                   {empty_raw_instructions with
                                    raw_constrain_rels = 
                                    [ConsiderRel rel];} )}
| _1 = IGNORE _2 = transition_sequence
    {                               ( let rel =
                                           let (start,ts) = _2 in
                                           match ts with
                                           | [] -> parse_error "not ignoring blank constraint"
                                           | (e,_) :: _ ->
                                               (e,List.map (fun (_,fin) -> (start,fin)) ts)
                                   in
                                   {empty_raw_instructions with
                                    raw_constrain_rels = 
                                    [IgnoreRel rel];} )}
| _1 = IGNORE _2 = prefixed_transition_sequence
    {                                        ( let rel =
                                           let (start,ts) = _2 in
                                           match ts with
                                           | [] -> parse_error "not ignoring blank constraint"
                                           | (e,_) :: _ ->
                                               (e,List.map (fun (_,fin) -> (start,fin)) ts)
                                   in
                                   {empty_raw_instructions with
                                    raw_constrain_rels = 
                                    [IgnoreRel rel];} )}
| _1 = ADD _2 = transition_sequence
    {                               ( {empty_raw_instructions with
                                     raw_add_rels = [_2]; } )}
| _1 = REMOVE _2 = transition_sequence
    {                                  ( {empty_raw_instructions with
                                        raw_remove_rels = [_2]; } )}
| _1 = ADD _2 = prefixed_transition_sequence
    {                                        ( {empty_raw_instructions with
                                              raw_add_rels = [_2]; } )}
| _1 = REMOVE _2 = prefixed_transition_sequence
    {                                           ( {empty_raw_instructions with
                                                 raw_remove_rels = [_2]; } )}
| _1 = ADD _2 = action_or_name_list
    {                               ( {empty_raw_instructions with
                                     raw_add_actions = _2; } )}
| _1 = REMOVE _2 = action_or_name_list
    {                                  ( {empty_raw_instructions with
                                        raw_remove_actions = _2; } )}
| _1 = modes
    {                          ( {empty_raw_instructions with
                                     raw_mode = _1} )}
| _1 = IGNORE _2 = checks
    {      ( {empty_raw_instructions with 
	 raw_checks = (List.map (fun c -> IgnoreCheck c) _2); } )}
| _1 = CONSIDER _2 = checks
    {      ( {empty_raw_instructions with 
	 raw_checks = (List.map (fun c -> ConsiderCheck c) _2); } )}
| _1 = DISPLAY_ACTION _2 = action_or_name_list
    {                                        ( {empty_raw_instructions with
                                       raw_node_instructions = [Raw_display_n _2]; } )}
| _1 = SUPPRESS_ACTION _2 = action_or_name_list
    {                                         ( {empty_raw_instructions with
                                        raw_node_instructions = [Raw_suppress_n _2]; } )}
| _1 = DISPLAY_EDGE _2 = edges
    {                                       ( {empty_raw_instructions with
                                        raw_edge_instructions = [Raw_display_e  (List.map (fun x -> (x,None)) _2)];} )}
| _1 = SUPPRESS_EDGE _2 = edges
    {                                        ( {empty_raw_instructions with
                                        raw_edge_instructions = [Raw_suppress_e (List.map (fun x -> (x,None)) _2)];} )}
| _1 = DISPLAY_EDGE _2 = prefixed_transition_sequence
    {                                              ( let (start,ts) = _2 in
                                           let e = 
                                             match ts with
                                             | (e,_) :: _ -> e
                                             | [] -> parse_error "Cannot happen: prefixed_transition_sequence w/o prefix"
                                           in
                                           {empty_raw_instructions with
                                             raw_edge_instructions = [Raw_display_e [e,Some (_2)]];})}
| _1 = SUPPRESS_EDGE _2 = prefixed_transition_sequence
    {                                               ( let (start,ts) = _2 in
                                           let e = 
                                             match ts with
                                             | (e,_) :: _ -> e
                                             | [] -> parse_error "Cannot happen: prefixed_transition_sequence w/o prefix"
                                           in
                                           {empty_raw_instructions with
                                             raw_edge_instructions = [Raw_suppress_e [e,Some (_2)]];})}

modes:
| _1 = mode
    {                           ( [_1] )}
| _1 = mode _2 = modes
    {                             ( _1 :: _2 )}

mode:
| _1 = SET _2 = FONTSIZE _3 = EQUALS _4 = IDENT
    {                               ( Fontsize (try int_of_string _4 with Invalid_argument _ -> parse_error "fontsize must be an int" ))}
| _1 = SET _2 = NODE_HEIGHT _3 = EQUALS _4 = FILENAME
    {                                    ( Node_height (try float_of_string _4 with Invalid_argument _ -> parse_error "node_height must be a float"))}
| _1 = SET _2 = NODE_WIDTH _3 = EQUALS _4 = FILENAME
    {                                   ( Node_width (try float_of_string _4 with Invalid_argument _ -> parse_error "node_width must be a float") )}
| _1 = SET _2 = FILLED _3 = EQUALS _4 = BOOL
    {                           ( Filled _4 )}
| _1 = SET _2 = XSCALE _3 = EQUALS _4 = FILENAME
    {                               ( Xscale (try float_of_string _4 with Invalid_argument _ -> parse_error "xscale must be a float") )}
| _1 = SET _2 = YSCALE _3 = EQUALS _4 = FILENAME
    {                               ( Yscale (try float_of_string _4 with Invalid_argument _ -> parse_error "yscale must be a float") )}
| _1 = SET _2 = RANKSEP _3 = EQUALS _4 = FILENAME
    {                                ( Ranksep (try float_of_string _4 with Invalid_argument _ -> parse_error "ranksep must be a float") )}
| _1 = SET _2 = NODESEP _3 = EQUALS _4 = FILENAME
    {                                ( Nodesep (try float_of_string _4 with Invalid_argument _ -> parse_error "nodesep must be a float") )}
| _1 = SET _2 = PENWIDTH _3 = EQUALS _4 = FILENAME
    {                                 ( Penwidth (try float_of_string _4 with Invalid_argument _ -> parse_error "penwidth must be a float") )}
| _1 = SET _2 = LEGEND _3 = EQUALS _4 = STRING
    {                             ( Legend (if _4="" then None else Some _4) )}
| _1 = SET _2 = LAYOUT _3 = EQUALS _4 = DOTFILE
    {                              ( Layout LO_dot )}
| _1 = SET _2 = LAYOUT _3 = EQUALS _4 = NEATO_PAR
    {                                ( Layout LO_neato_par )}
| _1 = SET _2 = LAYOUT _3 = EQUALS _4 = NEATO_PAR_INIT
    {                                     ( Layout LO_neato_par_init )}
| _1 = SET _2 = LAYOUT _3 = EQUALS _4 = NEATO_DOWNWARDS
    {                                      ( Layout LO_neato_downwards )}
| _1 = SET _2 = TEX _3 = EQUALS _4 = BOOL
    {                        ( Texmode _4 )}
| _1 = SET _2 = THREAD_IDS _3 = EQUALS _4 = BOOL
    {                               ( Thread_ids _4 )}

command:
| _1 = QUIT
    {                                  ( Quit )}
| _1 = NEXT
    {                                  ( Continue )}
| _1 = NONSTOP
    {                                  ( StopAt Never )}
| _1 = INTERMEDIATE
    {                                  ( StopAt Always )}
| _1 = NEXTCANDIDATE
    {                                  ( StopAt OnCandidates )}
| _1 = NEXTCONSISTENT
    {                                  ( StopAt OnSolutions )}
| _1 = HELP
    {                                  ( Help )}
| _1 = RELABEL
    {                                  ( Relabel )}
| _1 = GENERATE _2 = DOTFILE _3 = FILENAME
    {                                  ( Generate (Dot,_3) )}
| _1 = GENERATE _2 = ISAFILE _3 = FILENAME
    {                                  ( Generate (Isa,_3) )}
| _1 = GENERATE _2 = TEX _3 = FILENAME
    {                              ( Generate (Tex,_3) )}
| _1 = GENERATE _2 = EXCFILE _3 = FILENAME
    {                                  ( Generate (Exc,_3) )}
| _1 = GENERATE _2 = INSTRFILE _3 = FILENAME
    {                                  ( Generate (Instructions,_3) )}

items:
| _1 = item _2 = items
    {                                  ( _1 :: _2 )}
| _1 = EOF
    {                                  ( [] )}

item:
| _1 = MODEL _2 = COLON _3 = IDENT
    {                     ( Model _3 )}
| _1 = transition_sequence
    {                                  ( Trans _1 )}
| _1 = action_or_name
    {                                  ( Trans (_1,[]) )}
| _1 = prefixed_transition_sequence
    {                                  ( Trans _1 )}
| _1 = LOCATION_KINDS _2 = COLON _3 = lk
    {                                        ( Lk _3 )}
| _1 = output_edge_inst
    {                                       ( DisplayEdgeInstr _1 )}
| _1 = suppress_edge_inst
    {                                       ( SuppressEdgeInstr _1 )}
| _1 = DISPLAY_ACTION _2 = action_or_name_list _3 = DOT
    {                                              ( DisplayNodeInstr _2 )}
| _1 = SUPPRESS_ACTION _2 = action_or_name_list _3 = DOT
    {                                              ( SuppressNodeInstr _2 )}
| _1 = IGNORE _2 = checks
    {                                       ( Ignore _2 )}
| _1 = SHOW _2 = IDENT _3 = DOT
    {                                       ( let i = 
                                            try int_of_string _2 
                                            with Failure "int_of_string" -> parse_error ("Show expects a number, not " ^ _2) in 
                                         Show (Some i) )}
| _1 = SHOW _2 = ALL _3 = DOT
    {                                       ( Show None )}

checks:
| _1 = IDENT
    {                                 ( [_1] )}
| _1 = IDENT _2 = checks
    {                                 ( _1 :: _2 )}

output_edge_inst:
| _1 = DISPLAY_EDGE _2 = edges _3 = from_opt _4 = to_opt _5 = DOT
    {                                                       ( List.map (fun e -> (e,RawCrossProduct(_3,_4))) _2 )}
| _1 = DISPLAY_EDGE _2 = edges _3 = COLON _4 = action_edges _5 = DOT
    {                                                       ( List.map (fun e -> (e,RawExact _4)) _2 )}

suppress_edge_inst:
| _1 = SUPPRESS_EDGE _2 = edges _3 = from_opt _4 = to_opt _5 = DOT
    {                                                        ( List.map (fun e -> (e,RawCrossProduct(_3,_4))) _2 )}
| _1 = SUPPRESS_EDGE _2 = edges _3 = COLON _4 = action_edges _5 = DOT
    {                                                        ( List.map (fun e -> (e,RawExact _4)) _2 )}

action_edges:
| _1 = action_edge
    {                               ( [_1] )}
| _1 = action_edge _2 = action_edges
    {                               ( _1 :: _2 )}

action_edge:
| _1 = action_or_name _2 = EDGEHEAD _3 = action_or_name
    {                                          ( (_1,_3) )}

edgename:
| _1 = MO
    {                              ( match _1 with | Atomic Cmm.Seq_cst -> "sc" | _ -> parse_error "non-\"sc\" memory order appearing in relation name position")}
| _1 = IDENT
    {                               ( _1 )}

edges:
| _1 = edgename
    {                                    ( [_1] )}
| _1 = edgename _2 = edges
    {                                   ( _1 :: _2 )}

from_opt:
| 
    {                                       ( All )}
| _1 = FROM _2 = action_or_name_list
    {                                       ( Actions _2 )}
| _1 = FROM _2 = ALL
    {                                       ( All )}

to_opt:
| 
    {                                       ( All )}
| _1 = TO _2 = action_or_name_list
    {                                       ( Actions _2 )}
| _1 = TO _2 = ALL
    {                                       ( All )}

action_or_name_list:
| _1 = action_or_name
    {                                       ( [_1] )}
| _1 = action_or_name _2 = action_or_name_list
    {                                       ( _1 :: _2 )}

transition_sequence:
| _1 = action_or_name _2 = EDGETAIL _3 = edgename _4 = EDGEHEAD _5 = action_or_name
    {                                                              ( (_1,[(_3,_5)]) )}
| _1 = transition_sequence _2 = EDGETAIL _3 = edgename _4 = EDGEHEAD _5 = action_or_name
    {                                                                     ( let (start,trans)= _1 in (start,trans@[(_3,_5)]) )}

prefixed_transition_sequence:
| _1 = edgename _2 = COLON _3 = prefixed_transition_sequence_body
    {                                                        ( let (start,trans)=_3 in (start, List.map (function x -> (_1,x)) trans) )}

prefixed_transition_sequence_body:
| _1 = action_or_name
    {                   ( (_1,[]) )}
| _1 = prefixed_transition_sequence_body _2 = EDGEHEAD _3 = action_or_name
    {                                                                ( let (start,trans) = _1 in (start,trans@[_3]) )}

action_or_name:
| _1 = IDENT
    {           ( Action_name _1 )}
| _1 = action
    {           ( Action _1 )}

action:
| _1 = IDENT _2 = SEMICOLON _3 = IDENT _4 = COLON _5 = L _6 = location _7 = LOCKOUTCOME
    {                                                        ( Cmm.Lock(_1,named_thread_id _3, _6, _7) )}
| _1 = IDENT _2 = SEMICOLON _3 = IDENT _4 = COLON _5 = U _6 = location
    {                                            ( Cmm.Unlock(_1,named_thread_id _3,_6) )}
| _1 = IDENT _2 = SEMICOLON _3 = IDENT _4 = COLON _5 = R _6 = location _7 = EQUALS _8 = valu
    {      ( match _5 with 
      | Nonatomic -> Cmm.Load (_1,named_thread_id _3,Cmm.NA,_6,_8)
      | Atomic mo -> Cmm.Load (_1,named_thread_id _3,mo,_6,_8) 
      | Mutex -> raise (Failure "parse error: R with mutex type"))}
| _1 = IDENT _2 = SEMICOLON _3 = IDENT _4 = COLON _5 = W _6 = location _7 = EQUALS _8 = valu
    {      ( match _5 with 
      | Nonatomic -> Cmm.Store (_1,named_thread_id _3,Cmm.NA,_6,_8)
      | Atomic mo -> Cmm.Store (_1,named_thread_id _3,mo,_6,_8)
      | Mutex -> raise (Failure "parse error: W with mutex type"))}
| _1 = IDENT _2 = SEMICOLON _3 = IDENT _4 = COLON _5 = RMW _6 = location _7 = EQUALS _8 = valu _9 = SLASH _10 = valu
    {      ( match _5 with 
      | Nonatomic -> raise (Failure "parse error: RMW with nonatomic order type")
      | Atomic mo -> Cmm.RMW (_1,named_thread_id _3,mo,_6,_8,_10)
      | Mutex -> raise (Failure "parse error: RMW with mutex type") )}
| _1 = IDENT _2 = SEMICOLON _3 = IDENT _4 = COLON _5 = RMW _6 = location
    {      ( (* TODO: jp: have an actual rule to parse blocked RMWs *)
        match _5 with
        | Nonatomic -> raise (Failure "parse error: BRMW with nonatomic order type")
        | Atomic mo -> Cmm.Blocked_rmw (_1,named_thread_id _3,_6)
        | Mutex -> raise (Failure "parse error: BRMW with mutex type") )}
| _1 = IDENT _2 = SEMICOLON _3 = IDENT _4 = COLON _5 = F
    {      ( match _5 with 
      | Nonatomic -> raise (Failure "parse error: F with nonatomic order type")
      | Atomic mo -> Cmm.Fence (_1,named_thread_id _3,mo)
      | Mutex -> raise (Failure "parse error: F with mutex type") )}

location:
| _1 = IDENT
    {          ( Cmm.Rigid (Cmm.Symbolic _1) )}

valu:
| _1 = IDENT
    {          ( Cmm.Rigid (Cmm.Symbolic _1) )}

lk:
| _1 = LBRACE _2 = lk_body _3 = RBRACE
    {                          ( _2 )}
| _1 = LBRACE _2 = RBRACE
    {                  ( [] )}

lk_body:
| _1 = location _2 = COLON _3 = location_kind
    {                                                  (      [(_1,_3)] )}
| _1 = lk_body _2 = COMMA _3 = location _4 = COLON _5 = location_kind
    {                                                  ( _1 @ [(_3,_5)] )}

location_kind:
| _1 = ATOMIC
    {              ( Cmm.Atomic )}
| _1 = NONATOMIC
    {              ( Cmm.Non_Atomic )}
| _1 = MUTEX
    {              ( Cmm.Mutex )}

skeletonexecfile:
| _1 = skeleton_items
    {                  ( _1 )}

skeleton_items:
| _1 = skeleton_item _2 = skeleton_items
    {                                                    ( _1 :: _2 )}
| _1 = EOF
    {                                  ( [] )}

skeleton_item:
| _1 = skeleton_transition_sequence
    {                                           ( S_Trans _1 )}
| _1 = skeleton_action_or_name
    {                                           ( S_Trans (_1,[]) )}
| _1 = skeleton_prefixed_transition_sequence
    {                                           ( S_Trans _1 )}
| _1 = SAMELOC _2 = COLON _3 = skeleton_action_set_set
    {                                           ( S_Sameloc _3 )}
| _1 = ATOMICLOCS _2 = COLON _3 = skeleton_action_set
    {                                           ( S_Atomiclocs _3 )}

skeleton_transition_sequence:
| _1 = skeleton_action_or_name _2 = EDGETAIL _3 = edgename _4 = EDGEHEAD _5 = skeleton_action_or_name
    {                                                                                ( (_1,[(_3,_5)]) )}
| _1 = skeleton_transition_sequence _2 = EDGETAIL _3 = edgename _4 = EDGEHEAD _5 = skeleton_action_or_name
    {                                                                                       ( let (start,trans)= _1 in (start,trans@[(_3,_5)]) )}

skeleton_prefixed_transition_sequence:
| _1 = edgename _2 = COLON _3 = skeleton_prefixed_transition_sequence_body
    {                                                                 ( let (start,trans)=_3 in (start, List.map (function x -> (_1,x)) trans) )}

skeleton_prefixed_transition_sequence_body:
| _1 = skeleton_action_or_name
    {                            ( (_1,[]) )}
| _1 = skeleton_prefixed_transition_sequence_body _2 = EDGEHEAD _3 = skeleton_action_or_name
    {                                                                                  ( let (start,trans) = _1 in (start,trans@[_3]) )}

skeleton_action_set_set:
| _1 = LBRACE _2 = skeleton_action_set_set_body _3 = RBRACE
    {                                               ( _2 )}
| _1 = LBRACE _2 = RBRACE
    {                  ( [] )}

skeleton_action_set_set_body:
| _1 = skeleton_action_set
    {                        ( [_1] )}
| _1 = skeleton_action_set_set_body _2 = COMMA _3 = skeleton_action_set
    {                                                             ( _1 @ [_3] )}

skeleton_action_set:
| _1 = LBRACE _2 = skeleton_action_set_body _3 = RBRACE
    {                                           ( _2 )}
| _1 = LBRACE _2 = RBRACE
    {                  ( [] )}

skeleton_action_set_body:
| _1 = skeleton_action_or_name
    {                            ( [_1] )}
| _1 = skeleton_action_set_body _2 = COMMA _3 = skeleton_action_or_name
    {                                                             ( _1 @ [_3] )}

skeleton_action_or_name:
| _1 = IDENT
    {           ( S_Action_name _1 )}
| _1 = skeleton_action
    {                    ( S_Action _1 )}

skeleton_action:
| _1 = IDENT _2 = SEMICOLON _3 = IDENT _4 = COLON _5 = L
    {                                   ( S_Lock(_1,named_thread_id _3) )}
| _1 = IDENT _2 = SEMICOLON _3 = IDENT _4 = COLON _5 = U
    {                                   ( S_Unlock(_1,named_thread_id _3) )}
| _1 = IDENT _2 = SEMICOLON _3 = IDENT _4 = COLON _5 = RSKEL _6 = skeleton_mos
    {                                                   ( S_Read(_1,named_thread_id _3,_6) )}
| _1 = IDENT _2 = SEMICOLON _3 = IDENT _4 = COLON _5 = WSKEL _6 = skeleton_mos
    {                                                   ( S_Write(_1,named_thread_id _3,_6) )}
| _1 = IDENT _2 = SEMICOLON _3 = IDENT _4 = COLON _5 = RMWSKEL _6 = skeleton_mos
    {                                                     ( S_Atomic_rmw(_1,named_thread_id _3,_6) )}
| _1 = IDENT _2 = SEMICOLON _3 = IDENT _4 = COLON _5 = FSKEL _6 = skeleton_mos
    {                                                   ( S_Fence(_1,named_thread_id _3,_6) )}

skeleton_mos:
| _1 = STAR
    {          ( MO_Star )}
| _1 = ATOMIC
    {           ( MO_Atomic )}
| _1 = LBRACE _2 = skeleton_mo_set_body _3 = RBRACE
    {                                       ( MO_Set _2 )}

skeleton_mo_set_body:
| _1 = MO
    {       ( [_1] )}
| _1 = skeleton_mo_set_body _2 = COMMA _3 = MO
    {                                   ( _1 @ [_3] )}

%%