liberty_parser.mly 32.2 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 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864
%token EMPTY
%token	LIBERTY_ATTRENUM_address
%token	LIBERTY_ATTRENUM_address_width
%token	LIBERTY_ATTRENUM_area
%token	LIBERTY_ATTRENUM_area_coefficient
%token	LIBERTY_ATTRENUM_auxiliary_pad_cell
%token	LIBERTY_ATTRENUM_base_curves_group
%token	LIBERTY_ATTRENUM_base_curve_type
%token	LIBERTY_ATTRENUM_base_type
%token	LIBERTY_ATTRENUM_bit_from
%token	LIBERTY_ATTRENUM_bit_to
%token	LIBERTY_ATTRENUM_bit_width
%token	LIBERTY_ATTRENUM_bus_naming_style
%token	LIBERTY_ATTRENUM_bus_type
%token	LIBERTY_ATTRENUM_calc_mode
%token	LIBERTY_ENUM_capacitance
%token	LIBERTY_ATTRENUM_capacitive_load_unit
%token	LIBERTY_ATTRENUM_cell_footprint
%token	LIBERTY_ATTRENUM_cell_leakage_power
%token	LIBERTY_ATTRENUM_cell_name
%token	LIBERTY_ATTRENUM_clear
%token	LIBERTY_ATTRENUM_clear_preset_var1
%token	LIBERTY_ATTRENUM_clear_preset_var2
%token	LIBERTY_ATTRENUM_clock
%token	LIBERTY_ATTRENUM_clocked_on
%token	LIBERTY_ATTRENUM_clocked_on_also
%token	LIBERTY_ATTRENUM_clock_gate_clock_pin
%token	LIBERTY_ATTRENUM_clock_gate_enable_pin
%token	LIBERTY_ATTRENUM_clock_gate_obs_pin
%token	LIBERTY_ATTRENUM_clock_gate_out_pin
%token	LIBERTY_ATTRENUM_clock_gate_test_pin
%token	LIBERTY_ATTRENUM_clock_gating_flag
%token	LIBERTY_ATTRENUM_clock_gating_integrated_cell
%token	LIBERTY_ATTRENUM_clock_pin
%token	LIBERTY_ATTRENUM_coefs
%token	LIBERTY_ATTRENUM_column_address
%token	LIBERTY_ATTRENUM_comment
%token	LIBERTY_ATTRENUM_complementary_pin
%token	LIBERTY_ATTRENUM_connection_class
%token	LIBERTY_ATTRENUM_constraint
%token	LIBERTY_ATTRENUM_constraint_high
%token	LIBERTY_ATTRENUM_constraint_low
%token	LIBERTY_ATTRENUM_contention_condition
%token	LIBERTY_ATTRENUM_current_unit
%token	LIBERTY_ATTRENUM_curve_id
%token	LIBERTY_ATTRENUM_curve_x
%token	LIBERTY_ATTRENUM_curve_y
%token	LIBERTY_ATTRENUM_data_in
%token	LIBERTY_ATTRENUM_data_type
%token	LIBERTY_ATTRENUM_date
%token	LIBERTY_ATTRENUM_dcm_timing
%token	LIBERTY_ATTRENUM_default_cell_failure_rate
%token	LIBERTY_ATTRENUM_default_cell_leakage_power
%token	LIBERTY_ATTRENUM_default_connection_class
%token	LIBERTY_ATTRENUM_default_edge_rate_breakpoint_f0
%token	LIBERTY_ATTRENUM_default_edge_rate_breakpoint_f1
%token	LIBERTY_ATTRENUM_default_edge_rate_breakpoint_r0
%token	LIBERTY_ATTRENUM_default_edge_rate_breakpoint_r1
%token	LIBERTY_ATTRENUM_default_fall_delay_intercept
%token	LIBERTY_ATTRENUM_default_fall_pin_resistance
%token	LIBERTY_ATTRENUM_default_fanout_load
%token	LIBERTY_ATTRENUM_default_hold_coefficient
%token	LIBERTY_ATTRENUM_default_inout_pin_cap
%token	LIBERTY_ATTRENUM_default_inout_pin_fall_res
%token	LIBERTY_ATTRENUM_default_inout_pin_rise_res
%token	LIBERTY_ATTRENUM_default_input_pin_cap
%token	LIBERTY_ATTRENUM_default_intrinsic_fall
%token	LIBERTY_ATTRENUM_default_intrinsic_rise
%token	LIBERTY_ATTRENUM_default_leakage_power_density
%token	LIBERTY_ATTRENUM_default_max_capacitance
%token	LIBERTY_ATTRENUM_default_max_fanout
%token	LIBERTY_ATTRENUM_default_max_transition
%token	LIBERTY_ATTRENUM_default_max_utilization
%token	LIBERTY_ATTRENUM_default_min_porosity
%token	LIBERTY_ATTRENUM_default_operating_conditions
%token	LIBERTY_ATTRENUM_default_output_pin_cap
%token	LIBERTY_ATTRENUM_default_output_pin_fall_res
%token	LIBERTY_ATTRENUM_default_output_pin_rise_res
%token	LIBERTY_ATTRENUM_default_power_rail
%token	LIBERTY_ATTRENUM_default_rc_fall_coefficient
%token	LIBERTY_ATTRENUM_default_rc_rise_coefficient
%token	LIBERTY_ATTRENUM_default_reference_capacitance
%token	LIBERTY_ATTRENUM_default_rise_delay_intercept
%token	LIBERTY_ATTRENUM_default_rise_pin_resistance
%token	LIBERTY_ATTRENUM_default_setup_coefficient
%token	LIBERTY_ATTRENUM_default_slope_fall
%token	LIBERTY_ATTRENUM_default_slope_rise
%token	LIBERTY_ATTRENUM_default_threshold_voltage_group
%token	LIBERTY_ATTRENUM_default_timing
%token	LIBERTY_ATTRENUM_default_wire_load
%token	LIBERTY_ATTRENUM_default_wire_load_area
%token	LIBERTY_ATTRENUM_default_wire_load_capacitance
%token	LIBERTY_ATTRENUM_default_wire_load_mode
%token	LIBERTY_ATTRENUM_default_wire_load_resistance
%token	LIBERTY_ATTRENUM_default_wire_load_selection
%token	LIBERTY_ATTRENUM_define_cell_area
%token	LIBERTY_ATTRENUM_delay_model
%token	LIBERTY_ATTRENUM_direction
%token	LIBERTY_ATTRENUM_divided_by
%token	LIBERTY_ATTRENUM_dont_fault
%token	LIBERTY_ATTRENUM_dont_touch
%token	LIBERTY_ATTRENUM_dont_use
%token	LIBERTY_ATTRENUM_downto
%token	LIBERTY_ATTRENUM_drive_current
%token	LIBERTY_ATTRENUM_driver_type
%token	LIBERTY_ATTRENUM_driver_waveform
%token	LIBERTY_ATTRENUM_driver_waveform_fall
%token	LIBERTY_ATTRENUM_driver_waveform_name
%token	LIBERTY_ATTRENUM_driver_waveform_rise
%token	LIBERTY_ATTRENUM_duty_cycle
%token	LIBERTY_ATTRENUM_edge_rate_breakpoint_f0
%token	LIBERTY_ATTRENUM_edge_rate_breakpoint_f1
%token	LIBERTY_ATTRENUM_edge_rate_breakpoint_r0
%token	LIBERTY_ATTRENUM_edge_rate_breakpoint_r1
%token	LIBERTY_ATTRENUM_edge_rate_fall
%token	LIBERTY_ATTRENUM_edge_rate_load_fall
%token	LIBERTY_ATTRENUM_edge_rate_load_rise
%token	LIBERTY_ATTRENUM_edge_rate_rise
%token	LIBERTY_ATTRENUM_edge_rate_sensitivity_f0
%token	LIBERTY_ATTRENUM_edge_rate_sensitivity_f1
%token	LIBERTY_ATTRENUM_edge_rate_sensitivity_r0
%token	LIBERTY_ATTRENUM_edge_rate_sensitivity_r1
%token	LIBERTY_ATTRENUM_edges
%token	LIBERTY_ATTRENUM_edge_type
%token	LIBERTY_ATTRENUM_em_temp_degradation_factor
%token	LIBERTY_ATTRENUM_enable
%token	LIBERTY_ATTRENUM_enable_also
%token	LIBERTY_ATTRENUM_equal_or_opposite_output
%token	LIBERTY_ATTRENUM_failure_rate
%token	LIBERTY_ENUM_fall_capacitance
%token	LIBERTY_ENUM_fall_capacitance_range
%token	LIBERTY_ATTRENUM_fall_current_slope_after_threshold
%token	LIBERTY_ATTRENUM_fall_current_slope_before_threshold
%token	LIBERTY_ATTRENUM_fall_delay_intercept
%token	LIBERTY_ATTRENUM_falling_together_group
%token	LIBERTY_ATTRENUM_fall_pin_resistance
%token	LIBERTY_ATTRENUM_fall_resistance
%token	LIBERTY_ATTRENUM_fall_time_after_threshold
%token	LIBERTY_ATTRENUM_fall_time_before_threshold
%token	LIBERTY_ATTRENUM_fanout_area
%token	LIBERTY_ATTRENUM_fanout_capacitance
%token	LIBERTY_ATTRENUM_fanout_length
%token	LIBERTY_ATTRENUM_fanout_load
%token	LIBERTY_ATTRENUM_fanout_resistance
%token	LIBERTY_ATTRENUM_faster_factor
%token	LIBERTY_ATTRENUM_fault_model
%token	LIBERTY_ATTRENUM_force_00
%token	LIBERTY_ATTRENUM_force_01
%token	LIBERTY_ATTRENUM_force_10
%token	LIBERTY_ATTRENUM_force_11
%token	LIBERTY_ATTRENUM_force_inverter_removal
%token	LIBERTY_ATTRENUM_fpga_allow_duplicate_degenerated_gates
%token	LIBERTY_ATTRENUM_fpga_bridge_inputs
%token	LIBERTY_ATTRENUM_fpga_cell_type
%token	LIBERTY_ATTRENUM_fpga_complex_degenerate
%token	LIBERTY_ATTRENUM_fpga_degenerate_output
%token	LIBERTY_ATTRENUM_fpga_family
%token	LIBERTY_ATTRENUM_fpga_lut_insert_before_sequential
%token	LIBERTY_ATTRENUM_fpga_lut_output
%token	LIBERTY_ATTRENUM_fpga_max_degen_input_size
%token	LIBERTY_ATTRENUM_fpga_min_degen_input_size
%token	LIBERTY_ATTRENUM_fpga_prefer_undegenerated_gates
%token	LIBERTY_ATTRENUM_fpga_timing_type
%token	LIBERTY_ATTRENUM_fsim_map
%token	LIBERTY_ATTRENUM_function
%token	LIBERTY_ATTRENUM_geometry_print
%token	LIBERTY_ATTRENUM_handle_negative_constraint
%token	LIBERTY_ATTRENUM_has_builtin_pad
%token	LIBERTY_ATTRENUM_height_coefficient
%token	LIBERTY_ATTRENUM_high
%token	LIBERTY_ATTRENUM_hold_coefficient
%token	LIBERTY_ATTRENUM_hysteresis
%token	LIBERTY_ATTRENUM_ignore_verify_icg_type
%token	LIBERTY_ATTRENUM_index_1
%token	LIBERTY_ATTRENUM_index_2
%token	LIBERTY_ATTRENUM_index_3
%token	LIBERTY_ATTRENUM_index_4
%token	LIBERTY_ATTRENUM_index_output
%token	LIBERTY_ATTRENUM_in_place_swap_mode
%token	LIBERTY_ATTRENUM_input_high_value
%token	LIBERTY_ATTRENUM_input_low_value
%token	LIBERTY_ATTRENUM_input_map
%token	LIBERTY_ATTRENUM_input_map_shift
%token	LIBERTY_ATTRENUM_input_pins
%token	LIBERTY_ATTRENUM_input_signal_level
%token	LIBERTY_ATTRENUM_input_signal_level_high
%token	LIBERTY_ATTRENUM_input_signal_level_low
%token	LIBERTY_ATTRENUM_input_switching_condition
%token	LIBERTY_ATTRENUM_input_threshold_pct_fall
%token	LIBERTY_ATTRENUM_input_threshold_pct_rise
%token	LIBERTY_ENUM_input_voltage
%token	LIBERTY_ATTRENUM_input_voltage_range
%token	LIBERTY_ATTRENUM_interdependence_id
%token	LIBERTY_ATTRENUM_interface_timing
%token	LIBERTY_ATTRENUM_intermediate_values
%token	LIBERTY_ATTRENUM_internal_node
%token	LIBERTY_ATTRENUM_intrinsic_fall
%token	LIBERTY_ATTRENUM_intrinsic_rise
%token	LIBERTY_ATTRENUM_invert
%token	LIBERTY_ATTRENUM_inverted_output
%token	LIBERTY_ATTRENUM_is_clock_gating_cell
%token	LIBERTY_ATTRENUM_is_inverting
%token	LIBERTY_ATTRENUM_is_isolation_cell
%token	LIBERTY_ATTRENUM_is_level_shifter
%token	LIBERTY_ATTRENUM_is_needed
%token	LIBERTY_ATTRENUM_isolation_cell_data_pin
%token	LIBERTY_ATTRENUM_isolation_cell_enable_pin
%token	LIBERTY_ATTRENUM_is_pad
%token	LIBERTY_ATTRENUM_is_three_state
%token	LIBERTY_ATTRENUM_key_bit
%token	LIBERTY_ATTRENUM_key_feature
%token	LIBERTY_ATTRENUM_key_file
%token	LIBERTY_ATTRENUM_key_seed
%token	LIBERTY_ATTRENUM_key_version
%token	LIBERTY_ATTRENUM_k_process_cell_degradation
%token	LIBERTY_ATTRENUM_k_process_cell_fall
%token	LIBERTY_ATTRENUM_k_process_cell_leakage_power
%token	LIBERTY_ATTRENUM_k_process_cell_rise
%token	LIBERTY_ATTRENUM_k_process_drive_current
%token	LIBERTY_ATTRENUM_k_process_drive_fall
%token	LIBERTY_ATTRENUM_k_process_drive_rise
%token	LIBERTY_ATTRENUM_k_process_fall_delay_intercept
%token	LIBERTY_ATTRENUM_k_process_fall_pin_resistance
%token	LIBERTY_ATTRENUM_k_process_fall_propagation
%token	LIBERTY_ATTRENUM_k_process_fall_transition
%token	LIBERTY_ATTRENUM_k_process_hold_fall
%token	LIBERTY_ATTRENUM_k_process_hold_rise
%token	LIBERTY_ATTRENUM_k_process_internal_power
%token	LIBERTY_ATTRENUM_k_process_intrinsic_fall
%token	LIBERTY_ATTRENUM_k_process_intrinsic_rise
%token	LIBERTY_ATTRENUM_k_process_min_period
%token	LIBERTY_ATTRENUM_k_process_min_pulse_width_high
%token	LIBERTY_ATTRENUM_k_process_min_pulse_width_low
%token	LIBERTY_ATTRENUM_k_process_nochange_fall
%token	LIBERTY_ATTRENUM_k_process_nochange_rise
%token	LIBERTY_ATTRENUM_k_process_pin_cap
%token	LIBERTY_ATTRENUM_k_process_pin_fall_cap
%token	LIBERTY_ATTRENUM_k_process_pin_rise_cap
%token	LIBERTY_ATTRENUM_k_process_recovery_fall
%token	LIBERTY_ATTRENUM_k_process_recovery_rise
%token	LIBERTY_ATTRENUM_k_process_removal_fall
%token	LIBERTY_ATTRENUM_k_process_removal_rise
%token	LIBERTY_ATTRENUM_k_process_rise_delay_intercept
%token	LIBERTY_ATTRENUM_k_process_rise_pin_resistance
%token	LIBERTY_ATTRENUM_k_process_rise_propagation
%token	LIBERTY_ATTRENUM_k_process_rise_transition
%token	LIBERTY_ATTRENUM_k_process_setup_fall
%token	LIBERTY_ATTRENUM_k_process_setup_rise
%token	LIBERTY_ATTRENUM_k_process_skew_fall
%token	LIBERTY_ATTRENUM_k_process_skew_rise
%token	LIBERTY_ATTRENUM_k_process_slope_fall
%token	LIBERTY_ATTRENUM_k_process_slope_rise
%token	LIBERTY_ATTRENUM_k_process_wire_cap
%token	LIBERTY_ATTRENUM_k_process_wire_res
%token	LIBERTY_ATTRENUM_k_temp_cell_degradation
%token	LIBERTY_ATTRENUM_k_temp_cell_fall
%token	LIBERTY_ATTRENUM_k_temp_cell_leakage_power
%token	LIBERTY_ATTRENUM_k_temp_cell_rise
%token	LIBERTY_ATTRENUM_k_temp_drive_current
%token	LIBERTY_ATTRENUM_k_temp_drive_fall
%token	LIBERTY_ATTRENUM_k_temp_drive_rise
%token	LIBERTY_ATTRENUM_k_temp_fall_delay_intercept
%token	LIBERTY_ATTRENUM_k_temp_fall_pin_resistance
%token	LIBERTY_ATTRENUM_k_temp_fall_propagation
%token	LIBERTY_ATTRENUM_k_temp_fall_transition
%token	LIBERTY_ATTRENUM_k_temp_hold_fall
%token	LIBERTY_ATTRENUM_k_temp_hold_rise
%token	LIBERTY_ATTRENUM_k_temp_internal_power
%token	LIBERTY_ATTRENUM_k_temp_intrinsic_fall
%token	LIBERTY_ATTRENUM_k_temp_intrinsic_rise
%token	LIBERTY_ATTRENUM_k_temp_min_period
%token	LIBERTY_ATTRENUM_k_temp_min_pulse_width_high
%token	LIBERTY_ATTRENUM_k_temp_min_pulse_width_low
%token	LIBERTY_ATTRENUM_k_temp_nochange_fall
%token	LIBERTY_ATTRENUM_k_temp_nochange_rise
%token	LIBERTY_ATTRENUM_k_temp_pin_cap
%token	LIBERTY_ATTRENUM_k_temp_recovery_fall
%token	LIBERTY_ATTRENUM_k_temp_recovery_rise
%token	LIBERTY_ATTRENUM_k_temp_removal_fall
%token	LIBERTY_ATTRENUM_k_temp_removal_rise
%token	LIBERTY_ATTRENUM_k_temp_rise_delay_intercept
%token	LIBERTY_ATTRENUM_k_temp_rise_pin_resistance
%token	LIBERTY_ATTRENUM_k_temp_rise_propagation
%token	LIBERTY_ATTRENUM_k_temp_rise_transition
%token	LIBERTY_ATTRENUM_k_temp_setup_fall
%token	LIBERTY_ATTRENUM_k_temp_setup_rise
%token	LIBERTY_ATTRENUM_k_temp_skew_fall
%token	LIBERTY_ATTRENUM_k_temp_skew_rise
%token	LIBERTY_ATTRENUM_k_temp_slope_fall
%token	LIBERTY_ATTRENUM_k_temp_slope_rise
%token	LIBERTY_ATTRENUM_k_temp_wire_cap
%token	LIBERTY_ATTRENUM_k_temp_wire_res
%token	LIBERTY_ATTRENUM_k_volt_cell_degradation
%token	LIBERTY_ATTRENUM_k_volt_cell_fall
%token	LIBERTY_ATTRENUM_k_volt_cell_leakage_power
%token	LIBERTY_ATTRENUM_k_volt_cell_rise
%token	LIBERTY_ATTRENUM_k_volt_drive_current
%token	LIBERTY_ATTRENUM_k_volt_drive_fall
%token	LIBERTY_ATTRENUM_k_volt_drive_rise
%token	LIBERTY_ATTRENUM_k_volt_fall_delay_intercept
%token	LIBERTY_ATTRENUM_k_volt_fall_pin_resistance
%token	LIBERTY_ATTRENUM_k_volt_fall_propagation
%token	LIBERTY_ATTRENUM_k_volt_fall_transition
%token	LIBERTY_ATTRENUM_k_volt_hold_fall
%token	LIBERTY_ATTRENUM_k_volt_hold_rise
%token	LIBERTY_ATTRENUM_k_volt_internal_power
%token	LIBERTY_ATTRENUM_k_volt_intrinsic_fall
%token	LIBERTY_ATTRENUM_k_volt_intrinsic_rise
%token	LIBERTY_ATTRENUM_k_volt_min_period
%token	LIBERTY_ATTRENUM_k_volt_min_pulse_width_high
%token	LIBERTY_ATTRENUM_k_volt_min_pulse_width_low
%token	LIBERTY_ATTRENUM_k_volt_nochange_fall
%token	LIBERTY_ATTRENUM_k_volt_nochange_rise
%token	LIBERTY_ATTRENUM_k_volt_pin_cap
%token	LIBERTY_ATTRENUM_k_volt_recovery_fall
%token	LIBERTY_ATTRENUM_k_volt_recovery_rise
%token	LIBERTY_ATTRENUM_k_volt_removal_fall
%token	LIBERTY_ATTRENUM_k_volt_removal_rise
%token	LIBERTY_ATTRENUM_k_volt_rise_delay_intercept
%token	LIBERTY_ATTRENUM_k_volt_rise_pin_resistance
%token	LIBERTY_ATTRENUM_k_volt_rise_propagation
%token	LIBERTY_ATTRENUM_k_volt_rise_transition
%token	LIBERTY_ATTRENUM_k_volt_setup_fall
%token	LIBERTY_ATTRENUM_k_volt_setup_rise
%token	LIBERTY_ATTRENUM_k_volt_skew_fall
%token	LIBERTY_ATTRENUM_k_volt_skew_rise
%token	LIBERTY_ATTRENUM_k_volt_slope_fall
%token	LIBERTY_ATTRENUM_k_volt_slope_rise
%token	LIBERTY_ATTRENUM_k_volt_wire_cap
%token	LIBERTY_ATTRENUM_k_volt_wire_res
%token	LIBERTY_ATTRENUM_leakage_power_unit
%token	LIBERTY_ATTRENUM_level_shifter_data_pin
%token	LIBERTY_ATTRENUM_level_shifter_enable_pin
%token	LIBERTY_ATTRENUM_level_shifter_type
%token	LIBERTY_ATTRENUM_library_features
%token	LIBERTY_ATTRENUM_low
%token	LIBERTY_ATTRENUM_lsi_pad
%token	LIBERTY_ATTRENUM_lsi_pad_fall
%token	LIBERTY_ATTRENUM_lsi_pad_rise
%token	LIBERTY_ATTRENUM_lsi_rounding_cutoff
%token	LIBERTY_ATTRENUM_lsi_rounding_digit
%token	LIBERTY_ATTRENUM_map_only
%token	LIBERTY_ATTRENUM_mapping
%token	LIBERTY_ATTRENUM_map_to_logic
%token	LIBERTY_ATTRENUM_master_pin
%token	LIBERTY_ATTRENUM_max_capacitance
%token	LIBERTY_ATTRENUM_max_fanout
%token	LIBERTY_ATTRENUM_max_input_noise_width
%token	LIBERTY_ATTRENUM_max_time_borrow
%token	LIBERTY_ATTRENUM_max_transition
%token	LIBERTY_ATTRENUM_members
%token	LIBERTY_ATTRENUM_miller_cap_fall
%token	LIBERTY_ATTRENUM_miller_cap_rise
%token	LIBERTY_ATTRENUM_min_capacitance
%token	LIBERTY_ATTRENUM_min_fanout
%token	LIBERTY_ATTRENUM_min_input_noise_width
%token	LIBERTY_ATTRENUM_min_period
%token	LIBERTY_ATTRENUM_min_pulse_width_high
%token	LIBERTY_ATTRENUM_min_pulse_width_low
%token	LIBERTY_ATTRENUM_min_transition
%token	LIBERTY_ATTRENUM_mode
%token	LIBERTY_ATTRENUM_mpm_libname
%token	LIBERTY_ATTRENUM_mpm_name
%token	LIBERTY_ATTRENUM_multicell_pad_pin
%token	LIBERTY_ATTRENUM_multiplied_by
%token	LIBERTY_ATTRENUM_next_state
%token	LIBERTY_ATTRENUM_nextstate_type
%token	LIBERTY_ATTRENUM_nom_calc_mode
%token	LIBERTY_ATTRENUM_nominal_va_values
%token	LIBERTY_ATTRENUM_nom_process
%token	LIBERTY_ATTRENUM_nom_temperature
%token	LIBERTY_ATTRENUM_nom_voltage
%token	LIBERTY_ATTRENUM_observe_node
%token	LIBERTY_ATTRENUM_orders
%token	LIBERTY_ATTRENUM_output_signal_level
%token	LIBERTY_ATTRENUM_output_signal_level_high
%token	LIBERTY_ATTRENUM_output_signal_level_low
%token	LIBERTY_ATTRENUM_output_switching_condition
%token	LIBERTY_ATTRENUM_output_threshold_pct_fall
%token	LIBERTY_ATTRENUM_output_threshold_pct_rise
%token	LIBERTY_ENUM_output_voltage
%token	LIBERTY_ATTRENUM_output_voltage_range
%token	LIBERTY_ATTRENUM_pad_cell
%token	LIBERTY_ATTRENUM_pad_type
%token	LIBERTY_ATTRENUM_parameter1
%token	LIBERTY_ATTRENUM_parameter2
%token	LIBERTY_ATTRENUM_parameter3
%token	LIBERTY_ATTRENUM_parameter4
%token	LIBERTY_ATTRENUM_parameter5
%token	LIBERTY_ATTRENUM_pg_function
%token	LIBERTY_ATTRENUM_pg_type
%token	LIBERTY_ATTRENUM_piece_define
%token	LIBERTY_ATTRENUM_piece_type
%token	LIBERTY_ATTRENUM_pin_equal
%token	LIBERTY_ATTRENUM_pin_func_type
%token	LIBERTY_ATTRENUM_pin_name_map
%token	LIBERTY_ATTRENUM_pin_names
%token	LIBERTY_ATTRENUM_pin_opposite
%token	LIBERTY_ATTRENUM_poly_convert
%token	LIBERTY_ATTRENUM_power_down_function
%token	LIBERTY_ATTRENUM_power_gating_cell
%token	LIBERTY_ATTRENUM_power_gating_pin
%token	LIBERTY_ATTRENUM_power_level
%token	LIBERTY_ATTRENUM_power_model
%token	LIBERTY_ATTRENUM_power_rail
%token	LIBERTY_ATTRENUM_preferred
%token	LIBERTY_ATTRENUM_preferred_input_pad_voltage
%token	LIBERTY_ATTRENUM_preferred_output_pad_slew_rate_control
%token	LIBERTY_ATTRENUM_preferred_output_pad_voltage
%token	LIBERTY_ATTRENUM_prefer_tied
%token	LIBERTY_ATTRENUM_preset
%token	LIBERTY_ATTRENUM_primary_output
%token	LIBERTY_ATTRENUM_process
%token	LIBERTY_ATTRENUM_pulling_current
%token	LIBERTY_ATTRENUM_pulling_resistance
%token	LIBERTY_ATTRENUM_pulling_resistance_unit
%token	LIBERTY_ATTRENUM_rail_connection
%token	LIBERTY_ATTRENUM_reference_capacitance
%token	LIBERTY_ATTRENUM_reference_time
%token	LIBERTY_ATTRENUM_related_bus_equivalent
%token	LIBERTY_ATTRENUM_related_bus_pins
%token	LIBERTY_ATTRENUM_related_falling_pin
%token	LIBERTY_ATTRENUM_related_ground_pin
%token	LIBERTY_ATTRENUM_related_input
%token	LIBERTY_ATTRENUM_related_inputs
%token	LIBERTY_ATTRENUM_related_internal_pg_pin
%token	LIBERTY_ATTRENUM_related_output
%token	LIBERTY_ATTRENUM_related_output_pin
%token	LIBERTY_ATTRENUM_related_outputs
%token	LIBERTY_ATTRENUM_related_pg_pin
%token	LIBERTY_ATTRENUM_related_pin
%token	LIBERTY_ATTRENUM_related_power_pin
%token	LIBERTY_ATTRENUM_related_rising_pin
%token	LIBERTY_ATTRENUM_related_switch_pin
%token	LIBERTY_ATTRENUM_resistance
%token	LIBERTY_ATTRENUM_resistance_unit
%token	LIBERTY_ATTRENUM_retention_cell
%token	LIBERTY_ATTRENUM_retention_pin
%token	LIBERTY_ATTRENUM_revision
%token	LIBERTY_ENUM_rise_capacitance
%token	LIBERTY_ENUM_rise_capacitance_range
%token	LIBERTY_ATTRENUM_rise_current_slope_after_threshold
%token	LIBERTY_ATTRENUM_rise_current_slope_before_threshold
%token	LIBERTY_ATTRENUM_rise_delay_intercept
%token	LIBERTY_ATTRENUM_rise_pin_resistance
%token	LIBERTY_ATTRENUM_rise_resistance
%token	LIBERTY_ATTRENUM_rise_time_after_threshold
%token	LIBERTY_ATTRENUM_rise_time_before_threshold
%token	LIBERTY_ATTRENUM_rising_together_group
%token	LIBERTY_ATTRENUM_routing_layers
%token	LIBERTY_ATTRENUM_row_address
%token	LIBERTY_ENUM_scaling_factors
%token	LIBERTY_ATTRENUM_scan_group
%token	LIBERTY_ATTRENUM_sdf_cond
%token	LIBERTY_ATTRENUM_sdf_cond_end
%token	LIBERTY_ATTRENUM_sdf_cond_start
%token	LIBERTY_ATTRENUM_sdf_edges
%token	LIBERTY_ATTRENUM_sensitization_master
%token	LIBERTY_ATTRENUM_set_node
%token	LIBERTY_ATTRENUM_setup_coefficient
%token	LIBERTY_ATTRENUM_shifts
%token	LIBERTY_ATTRENUM_short
%token	LIBERTY_ATTRENUM_signal_type
%token	LIBERTY_ATTRENUM_simulation
%token	LIBERTY_ATTRENUM_single_bit_degenerate
%token	LIBERTY_ATTRENUM_slew_control
%token	LIBERTY_ATTRENUM_slew_derate_from_library
%token	LIBERTY_ATTRENUM_slew_lower_threshold_pct_fall
%token	LIBERTY_ATTRENUM_slew_lower_threshold_pct_rise
%token	LIBERTY_ATTRENUM_slew_upper_threshold_pct_fall
%token	LIBERTY_ATTRENUM_slew_upper_threshold_pct_rise
%token	LIBERTY_ATTRENUM_slope
%token	LIBERTY_ATTRENUM_slope_fall
%token	LIBERTY_ATTRENUM_slope_rise
%token	LIBERTY_ATTRENUM_slower_factor
%token	LIBERTY_ATTRENUM_stage_type
%token	LIBERTY_ATTRENUM_state_function
%token	LIBERTY_ATTRENUM_std_cell_main_rail
%token	LIBERTY_ATTRENUM_steady_state_resistance_above_high
%token	LIBERTY_ATTRENUM_steady_state_resistance_below_low
%token	LIBERTY_ATTRENUM_steady_state_resistance_float_max
%token	LIBERTY_ATTRENUM_steady_state_resistance_float_min
%token	LIBERTY_ATTRENUM_steady_state_resistance_high
%token	LIBERTY_ATTRENUM_steady_state_resistance_high_max
%token	LIBERTY_ATTRENUM_steady_state_resistance_high_min
%token	LIBERTY_ATTRENUM_steady_state_resistance_low
%token	LIBERTY_ATTRENUM_steady_state_resistance_low_max
%token	LIBERTY_ATTRENUM_steady_state_resistance_low_min
%token	LIBERTY_ATTRENUM_switch_cell_type
%token	LIBERTY_ATTRENUM_switch_function
%token	LIBERTY_ATTRENUM_switching_interval
%token	LIBERTY_ATTRENUM_switching_together_group
%token	LIBERTY_ATTRENUM_switch_pin
%token	LIBERTY_ATTRENUM_table
%token	LIBERTY_ATTRENUM_tdisable
%token	LIBERTY_ATTRENUM_technology
%token	LIBERTY_ATTRENUM_temperature
%token	LIBERTY_ATTRENUM_test_output_only
%token	LIBERTY_ATTRENUM_three_state
%token	LIBERTY_ATTRENUM_threshold
%token	LIBERTY_ATTRENUM_threshold_voltage_group
%token	LIBERTY_ATTRENUM_tied_off
%token	LIBERTY_ATTRENUM_time_unit
%token	LIBERTY_ATTRENUM_timing_model_type
%token	LIBERTY_ATTRENUM_timing_report
%token	LIBERTY_ATTRENUM_timing_sense
%token	LIBERTY_ATTRENUM_timing_type
%token	LIBERTY_ATTRENUM_total_track_area
%token	LIBERTY_ATTRENUM_tracks
%token	LIBERTY_ATTRENUM_tree_type
%token	LIBERTY_ENUM_type
%token	LIBERTY_ATTRENUM_typical_capacitances
%token	LIBERTY_ATTRENUM_use_for_size_only
%token	LIBERTY_ATTRENUM_user_function_class
%token	LIBERTY_ATTRENUM_value
%token	LIBERTY_ATTRENUM_values
%token	LIBERTY_ATTRENUM_va_parameters
%token	LIBERTY_ATTRENUM_variable_1
%token	LIBERTY_ATTRENUM_variable_1_range
%token	LIBERTY_ATTRENUM_variable_2
%token	LIBERTY_ATTRENUM_variable_2_range
%token	LIBERTY_ATTRENUM_variable_3
%token	LIBERTY_ATTRENUM_variable_3_range
%token	LIBERTY_ATTRENUM_variable_4
%token	LIBERTY_ATTRENUM_variable_4_range
%token	LIBERTY_ATTRENUM_variable_5_range
%token	LIBERTY_ATTRENUM_variable_6_range
%token	LIBERTY_ATTRENUM_variable_7_range
%token	LIBERTY_ATTRENUM_variables
%token	LIBERTY_ATTRENUM_va_values
%token	LIBERTY_ENUM_vector
%token	LIBERTY_ATTRENUM_vhdl_name
%token	LIBERTY_ATTRENUM_vih
%token	LIBERTY_ATTRENUM_vil
%token	LIBERTY_ATTRENUM_vimax
%token	LIBERTY_ATTRENUM_vimin
%token	LIBERTY_ATTRENUM_voh
%token	LIBERTY_ATTRENUM_vol
%token	LIBERTY_ATTRENUM_voltage
%token	LIBERTY_ATTRENUM_voltage_map
%token	LIBERTY_ATTRENUM_voltage_name
%token	LIBERTY_ATTRENUM_voltage_unit
%token	LIBERTY_ATTRENUM_vomax
%token	LIBERTY_ATTRENUM_vomin
%token	LIBERTY_ATTRENUM_wave_fall
%token	LIBERTY_ATTRENUM_wave_rise
%token	LIBERTY_ATTRENUM_when
%token	LIBERTY_ATTRENUM_when_end
%token	LIBERTY_ATTRENUM_when_start
%token	LIBERTY_ATTRENUM_width_coefficient
%token	LIBERTY_ATTRENUM_wire_load_from_area
%token	LIBERTY_ATTRENUM_word_width
%token	LIBERTY_ATTRENUM_x_function
%token	LIBERTY_ATTRENUM_xnf_device_name
%token	LIBERTY_ATTRENUM_xnf_schnm
%token	LIBERTY_GROUPENUM_base_curves
%token	LIBERTY_GROUPENUM_bundle
%token	LIBERTY_GROUPENUM_bus
%token	LIBERTY_GROUPENUM_ccs_lu_table_template
%token	LIBERTY_GROUPENUM_ccsn_first_stage
%token	LIBERTY_GROUPENUM_ccsn_last_stage
%token	LIBERTY_GROUPENUM_ccs_timing_base_curve
%token	LIBERTY_GROUPENUM_ccs_timing_base_curve_template
%token	LIBERTY_GROUPENUM_cell
%token	LIBERTY_GROUPENUM_cell_degradation
%token	LIBERTY_GROUPENUM_cell_fall
%token	LIBERTY_GROUPENUM_cell_fall_to_pct
%token	LIBERTY_GROUPENUM_cell_rise
%token	LIBERTY_GROUPENUM_cell_rise_to_pct
%token	LIBERTY_GROUPENUM_compact_ccs_fall
%token	LIBERTY_GROUPENUM_compact_ccs_rise
%token	LIBERTY_GROUPENUM_compact_lut_template
%token	LIBERTY_GROUPENUM_compressed_ccs_timing_rise
%token	LIBERTY_GROUPENUM_dc_current
%token	LIBERTY_GROUPENUM_domain
%token	LIBERTY_GROUPENUM_dynamic_current
%token	LIBERTY_GROUPENUM_electromigration
%token	LIBERTY_GROUPENUM_em_lut_template
%token	LIBERTY_GROUPENUM_em_max_toggle_rate
%token	LIBERTY_GROUPENUM_fall_constraint
%token	LIBERTY_GROUPENUM_fall_net_delay
%token	LIBERTY_GROUPENUM_fall_power
%token	LIBERTY_GROUPENUM_fall_propagation
%token	LIBERTY_GROUPENUM_fall_transition
%token	LIBERTY_GROUPENUM_fall_transition_degradation
%token	LIBERTY_GROUPENUM_ff
%token	LIBERTY_GROUPENUM_ff_bank
%token	LIBERTY_GROUPENUM_gate_leakage
%token	LIBERTY_GROUPENUM_generated_clock
%token	LIBERTY_GROUPENUM_hyperbolic_noise_above_high
%token	LIBERTY_GROUPENUM_hyperbolic_noise_below_low
%token	LIBERTY_GROUPENUM_hyperbolic_noise_high
%token	LIBERTY_GROUPENUM_hyperbolic_noise_low
%token	LIBERTY_GROUPENUM_init_current
%token	LIBERTY_GROUPENUM_input_signal_swing
%token	LIBERTY_GROUPENUM_interconnect_delay
%token	LIBERTY_GROUPENUM_internal_power
%token	LIBERTY_GROUPENUM_intrinsic_capacitance
%token	LIBERTY_GROUPENUM_intrinsic_parasitic
%token	LIBERTY_GROUPENUM_intrinsic_resistance
%token	LIBERTY_GROUPENUM_iv_lut_template
%token	LIBERTY_GROUPENUM_latch
%token	LIBERTY_GROUPENUM_latch_bank
%token	LIBERTY_GROUPENUM_leakage_current
%token	LIBERTY_GROUPENUM_leakage_power
%token	LIBERTY_GROUPENUM_left_id
%token	LIBERTY_GROUPENUM_library
%token	LIBERTY_GROUPENUM_lower
%token	LIBERTY_GROUPENUM_lut
%token	LIBERTY_GROUPENUM_lu_table_template
%token	LIBERTY_GROUPENUM_max_cap
%token	LIBERTY_GROUPENUM_maxcap_lut_template
%token	LIBERTY_GROUPENUM_max_trans
%token	LIBERTY_GROUPENUM_maxtrans_lut_template
%token	LIBERTY_GROUPENUM_memory
%token	LIBERTY_GROUPENUM_memory_read
%token	LIBERTY_GROUPENUM_memory_write
%token	LIBERTY_GROUPENUM_minimum_period
%token	LIBERTY_GROUPENUM_min_pulse_width
%token	LIBERTY_GROUPENUM_mode_definition
%token	LIBERTY_GROUPENUM_model
%token	LIBERTY_GROUPENUM_mode_value
%token	LIBERTY_GROUPENUM_noise_immunity_above_high
%token	LIBERTY_GROUPENUM_noise_immunity_below_low
%token	LIBERTY_GROUPENUM_noise_immunity_high
%token	LIBERTY_GROUPENUM_noise_immunity_low
%token	LIBERTY_GROUPENUM_noise_lut_template
%token	LIBERTY_GROUPENUM_normalized_driver_waveform
%token	LIBERTY_GROUPENUM_operating_conditions
%token	LIBERTY_GROUPENUM_output_current_fall
%token	LIBERTY_GROUPENUM_output_current_rise
%token	LIBERTY_GROUPENUM_output_current_template
%token	LIBERTY_GROUPENUM_output_signal_swing
%token	LIBERTY_GROUPENUM_output_voltage_fall
%token	LIBERTY_GROUPENUM_output_voltage_rise
%token	LIBERTY_GROUPENUM_peak_current
%token	LIBERTY_GROUPENUM_peak_time
%token	LIBERTY_GROUPENUM_peak_voltage
%token	LIBERTY_GROUPENUM_pg_current
%token	LIBERTY_GROUPENUM_pg_current_template
%token	LIBERTY_GROUPENUM_pg_pin
%token	LIBERTY_GROUPENUM_pin
%token	LIBERTY_GROUPENUM_pin_based_variation
%token	LIBERTY_GROUPENUM_pin_capacitance
%token	LIBERTY_GROUPENUM_poly_template
%token	LIBERTY_GROUPENUM_power
%token	LIBERTY_GROUPENUM_power_lut_template
%token	LIBERTY_GROUPENUM_power_poly_template
%token	LIBERTY_GROUPENUM_power_supply
%token	LIBERTY_GROUPENUM_propagated_noise_height_above_high
%token	LIBERTY_GROUPENUM_propagated_noise_height_below_low
%token	LIBERTY_GROUPENUM_propagated_noise_height_high
%token	LIBERTY_GROUPENUM_propagated_noise_height_low
%token	LIBERTY_GROUPENUM_propagated_noise_high
%token	LIBERTY_GROUPENUM_propagated_noise_low
%token	LIBERTY_GROUPENUM_propagated_noise_peak_time_ratio_above_high
%token	LIBERTY_GROUPENUM_propagated_noise_peak_time_ratio_below_low
%token	LIBERTY_GROUPENUM_propagated_noise_peak_time_ratio_high
%token	LIBERTY_GROUPENUM_propagated_noise_peak_time_ratio_low
%token	LIBERTY_GROUPENUM_propagated_noise_width_above_high
%token	LIBERTY_GROUPENUM_propagated_noise_width_below_low
%token	LIBERTY_GROUPENUM_propagated_noise_width_high
%token	LIBERTY_GROUPENUM_propagated_noise_width_low
%token	LIBERTY_GROUPENUM_propagation_lut_template
%token	LIBERTY_GROUPENUM_receiver_capacitance
%token	LIBERTY_GROUPENUM_receiver_capacitance1_fall
%token	LIBERTY_GROUPENUM_receiver_capacitance1_rise
%token	LIBERTY_GROUPENUM_receiver_capacitance2_fall
%token	LIBERTY_GROUPENUM_receiver_capacitance2_rise
%token	LIBERTY_GROUPENUM_retain_fall_slew
%token	LIBERTY_GROUPENUM_retaining_fall
%token	LIBERTY_GROUPENUM_retaining_rise
%token	LIBERTY_GROUPENUM_retain_rise_slew
%token	LIBERTY_GROUPENUM_right_id
%token	LIBERTY_GROUPENUM_rise_constraint
%token	LIBERTY_GROUPENUM_rise_net_delay
%token	LIBERTY_GROUPENUM_rise_power
%token	LIBERTY_GROUPENUM_rise_propagation
%token	LIBERTY_GROUPENUM_rise_transition
%token	LIBERTY_GROUPENUM_rise_transition_degradation
%token	LIBERTY_GROUPENUM_routing_track
%token	LIBERTY_GROUPENUM_scaled_cell
%token	LIBERTY_GROUPENUM_sensitization
%token	LIBERTY_GROUPENUM_seq
%token	LIBERTY_GROUPENUM_seq_bank
%token	LIBERTY_GROUPENUM_state
%token	LIBERTY_GROUPENUM_statetable
%token	LIBERTY_GROUPENUM_steady_state_current_high
%token	LIBERTY_GROUPENUM_steady_state_current_low
%token	LIBERTY_GROUPENUM_steady_state_current_tristate
%token	LIBERTY_GROUPENUM_switching_group
%token	LIBERTY_GROUPENUM_test_cell
%token	LIBERTY_GROUPENUM_timing
%token	LIBERTY_GROUPENUM_timing_based_variation
%token	LIBERTY_GROUPENUM_timing_range
%token	LIBERTY_GROUPENUM_tlatch
%token	LIBERTY_GROUPENUM_upper
%token	LIBERTY_GROUPENUM_user_parameters
%token	LIBERTY_GROUPENUM_va_compact_ccs_fall
%token	LIBERTY_GROUPENUM_va_compact_ccs_rise
%token	LIBERTY_GROUPENUM_va_fall_constraint
%token	LIBERTY_GROUPENUM_va_receiver_capacitance1_fall
%token	LIBERTY_GROUPENUM_va_receiver_capacitance1_rise
%token	LIBERTY_GROUPENUM_va_receiver_capacitance2_fall
%token	LIBERTY_GROUPENUM_va_receiver_capacitance2_rise
%token	LIBERTY_GROUPENUM_va_rise_constraint
%token	LIBERTY_GROUPENUM_wire_load
%token	LIBERTY_GROUPENUM_wire_load_selection
%token	LIBERTY_GROUPENUM_wire_load_table

%token COMMA SEMI LPAR RPAR LCURLY RCURLY COLON KW_DEFINE KW_DEFINE_GROUP
%token KW_TRUE KW_FALSE PLUS MINUS MULT DIV EQ SIMPLE HEAD ATTR
%token KW_FLOAT KW_STRING KW_ENUM KW_INTEGER KW_SHORT KW_OR KW_AND
%token KW_BOOLEAN KW_LIST LBRACK RBRACK INCLUDE GROUP ENDOFFILE
%token UNARY

%token <float> NUM
%token <string> STRING
%token <token> ID
%token <token list> TLIST
// Generic double
%token<token*token> DOUBLE
// Generic triple
%token<token*token*token> TRIPLE
// Generic quadruple
%token<token*token*token*token> QUADRUPLE
// Generic quintuple
%token<token*token*token*token*token> QUINTUPLE
// Generic sextuple
%token<token*token*token*token*token*token> SEXTUPLE
// Generic septuple
%token<token*token*token*token*token*token*token> SEPTUPLE
// Generic octuple
%token<token*token*token*token*token*token*token*token> OCTUPLE

%left PLUS MINUS 
%left MULT DIV
%right UNARY

%type <token>		group file statement
%type <token list>	statements param_list
%type <token>		define define_group
%type <token>		attr_val attr_val_expr
%type <token>		s_or_i
%type <token>		head
%type <token>		expr

%start file

%%

file	: group { $1 }
	| ENDOFFILE { ENDOFFILE }
	;

group	: head LCURLY statements RCURLY { TRIPLE(GROUP, $1, TLIST $3); }
        | head LCURLY RCURLY { $1 }
	;

statements :
	| statement { [ $1 ] }
 	| statements statement { $1 @ [ $2 ] }
	;

statement :
	| simple_attr { $1 }
	| complex_attr { $1 }
	| define { $1 }
	| define_group { $1 }
	| group  { $1 }
	;

simple_attr :
	| ID COLON attr_val_expr SEMI { TRIPLE(SIMPLE, $1, $3) }
	| ID COLON attr_val_expr { TRIPLE(SIMPLE, $1, $3) }
	| ID EQ    attr_val_expr { TRIPLE(EQ, $1, $3) }
        | head  { $1 }
	;

complex_attr :
	head  SEMI  { $1 }
        ;

head :
	| ID LPAR param_list RPAR { TRIPLE(HEAD, $1, TLIST $3) }
        | ID LPAR RPAR            { $1 }
	;

param_list:
	| attr_val { [ $1 ] }
        | param_list COMMA attr_val { $1 @ [ $3 ] } 
	;

define:
	KW_DEFINE LPAR s_or_i COMMA s_or_i COMMA s_or_i RPAR SEMI  
                { QUADRUPLE(KW_DEFINE, $3, $5, $7) }

define_group:
	KW_DEFINE_GROUP LPAR s_or_i COMMA s_or_i RPAR SEMI
            { TRIPLE(KW_DEFINE_GROUP,$3,$5) } 
		;

s_or_i:
	STRING { STRING $1 }
	| ID { $1 }
	;

attr_val:
	NUM { NUM $1 }
	| s_or_i { $1 }
	| s_or_i COLON s_or_i { TRIPLE(ATTR, $1, $3) }
        | KW_TRUE { KW_TRUE }
	| KW_FALSE { KW_FALSE }
	;

attr_val_expr : STRING { STRING $1 }
	| KW_TRUE { KW_TRUE }
	| KW_FALSE { KW_FALSE }
	| expr { $1 }
	;

expr: expr PLUS expr 
           {
	   TRIPLE(PLUS, $1, $3);
           }
        | expr MINUS expr
           {
	   TRIPLE(MINUS, $1, $3);
           }
        | expr MULT expr
           {
	   TRIPLE(MULT, $1, $3);
           }
        | expr DIV expr
           {
	   TRIPLE(DIV, $1, $3);
           }
        | LPAR expr RPAR
           {
	   $2;
           }
        | MINUS expr %prec UNARY
           {
	   match $2 with
	   | NUM num -> NUM (-. num)
	   | _ -> DOUBLE(MINUS, $2);
           }
        | PLUS expr %prec UNARY
           {
	   match $2 with
	   | NUM num -> $2
	   | _ -> DOUBLE(PLUS, $2);
           }
        | NUM
           {
	   NUM $1
           }
        | ID
           {
	   $1
           }
        ;

%%