ics.opp.exp 16.6 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
Note: the nonterminal symbol list (from ics.mly) is renamed ics_list.
File "ics.mly", line 47, characters 13-19:
Warning: the token ACLBRA is unused.
File "ics.mly", line 47, characters 7-12:
Warning: the token ALBRA is unused.
File "ics.mly", line 50, characters 48-57:
Warning: the token BACKSLASH is unused.
File "ics.mly", line 45, characters 7-10:
Warning: the token BOT is unused.
File "ics.mly", line 57, characters 22-27:
Warning: the token BWAND is unused.
File "ics.mly", line 57, characters 45-50:
Warning: the token BWIFF is unused.
File "ics.mly", line 57, characters 39-44:
Warning: the token BWIMP is unused.
File "ics.mly", line 57, characters 16-21:
Warning: the token BWITE is unused.
File "ics.mly", line 57, characters 51-56:
Warning: the token BWNOT is unused.
File "ics.mly", line 57, characters 28-32:
Warning: the token BWOR is unused.
File "ics.mly", line 57, characters 33-38:
Warning: the token BWXOR is unused.
File "ics.mly", line 47, characters 20-25:
Warning: the token CLBRA is unused.
File "ics.mly", line 35, characters 28-36:
Warning: the token COMMANDS is unused.
File "ics.mly", line 50, characters 23-27:
Warning: the token DDOT is unused.
File "ics.mly", line 51, characters 36-40:
Warning: the token DIFF is unused.
File "ics.mly", line 61, characters 24-30:
Warning: the token DIVIDE is unused.
File "ics.mly", line 50, characters 38-47:
Warning: the token ENDMARKER is unused.
File "ics.mly", line 55, characters 13-17:
Warning: the token FREE is unused.
File "ics.mly", line 54, characters 22-27:
Warning: the token FRESH is unused.
File "ics.mly", line 37, characters 7-9:
Warning: the token IN is unused.
File "ics.mly", line 46, characters 11-17:
Warning: the token NEGINF is unused.
File "ics.mly", line 37, characters 10-15:
Warning: the token NOTIN is unused.
File "ics.mly", line 34, characters 82-91:
Warning: the token PARTITION is unused.
File "ics.mly", line 70, characters 7-11:
Warning: the token PROJ is unused.
File "ics.mly", line 49, characters 37-45:
Warning: the token PROPLPAR is unused.
File "ics.mly", line 49, characters 46-54:
Warning: the token PROPRPAR is unused.
File "ics.mly", line 68, characters 7-14:
Warning: the token PROPVAR is unused.
File "ics.mly", line 38, characters 11-16:
Warning: the token QUOTE is unused.
File "ics.mly", line 34, characters 34-37:
Warning: the token SET is unused.
File "ics.mly", line 35, characters 12-16:
Warning: the token SIGN is unused.
File "ics.mly", line 34, characters 73-81:
Warning: the token SOLUTION is unused.
File "ics.mly", line 35, characters 21-27:
Warning: the token SYNTAX is unused.
File "ics.mly", line 50, characters 35-37:
Warning: the token TO is unused.
File "ics.mly", line 34, characters 27-33:
Warning: the token TOGGLE is unused.
File "ics.mly", line 45, characters 23-26:
Warning: the token TOP is unused.
File "ics.mly", line 33, characters 7-11:
Warning: the token TYPE is unused.
File "ics.mly", line 49, characters 55-65:
Warning: the token UNDERSCORE is unused.
File "ics.mly", line 63, characters 7-15:
Warning: the token UNSIGNED is unused.
File "ics.mly", line 64, characters 7-11:
Warning: the token WITH is unused.
%{

(** Command parser. *)

  open Mpa
  open Tools

let name_of_slack = Name.of_string "k"
let name_of_zero_slack = Name.of_string "k0"
let name_of_rename = Name.of_string "v"


%}
%start atomeof
%start commands
%start commandseof
%start commandsequence
%start propeof
%start termeof
%token WITH
%token VALID
%token USE
%token UNTRACE
%token UNSIGNED
%token UNSAT
%token UNDO
%token UNDERSCORE
%token TYPE
%token TT
%token TRUE
%token TRACE
%token TOP
%token TOGGLE
%token THEN
%token TAIL
%token SYNTAX
%token SYMTAB
%token SUP
%token SUB
%token <string> STRING
%token SPLIT
%token SOLVE
%token SOLUTION
%token SIMPLIFY
%token SIGN
%token SIGMA
%token SIG
%token SHOW
%token SET
%token SAVE
%token SAT
%token S
%token RPAR
%token RESTORE
%token RESET
%token REMOVE
%token REAL
%token RCUR
%token RBRA
%token <Mpa.Q.t> RATCONST
%token QUOTE
%token PROPVAR
%token PROPRPAR
%token PROPLPAR
%token PROP
%token PROJ
%token PARTITION
%token OUTR
%token OUTL
%token OUT
%token NIL
%token NEGINF
%token NEG
%token MODEL
%token LPAR
%token LAMBDA
%token KLAMMERAFFE
%token K
%token INV
%token <int> INTCONST
%token INT
%token INR
%token INL
%token INJ
%token INF
%token IF
%token <string> IDENT
%token I
%token HELP
%token HEAD
%token GET
%token FULL
%token <string * int> FRESH
%token <int> FREE
%token FORGET
%token FIND
%token FF
%token FALSE
%token EXIT
%token EOF
%token ENDMARKER
%token END
%token EMPTY
%token ELSE
%token ECHO
%token DROP
%token DOT
%token DOM
%token DEF
%token DDOT
%token CTXT
%token CREATE
%token CONS
%token CONC
%token COMMANDS
%token COMMA
%token CMP
%token CLBRA
%token CHECK
%token CDR
%token CAR
%token CAN
%token C
%token BWNOT
%token BWITE
%token <string> BVCONST
%token BV
%token BOT
%token BACKSLASH
%token ASSIGN
%token ASSERT
%token ALBRA
%token ACLBRA
%token XOR
%token IMPL
%token DISJ
%token CONJ
%token BIIMPL
%token SUBSET
%token LESSOREQUAL
%token LESS
%token GREATEROREQUAL
%token GREATER
%token EQUAL
%token DISEQ
%token APPLY
%token UNION
%token INTER
%token DIFF
%token COMPL
%token PLUS
%token MINUS
%token DIVIDE
%token TIMES
%token EXPT
%token LISTCONS
%token BVCONC
%token BWXOR
%token BWOR
%token BWIMP
%token BWIFF
%token BWAND
%token TO
%token NOTIN
%token IN
%token LCUR
%token LBRA
%token COLON
%right XOR IMPL DISJ 
%left CONJ BIIMPL 
%nonassoc SUBSET LESSOREQUAL LESS GREATEROREQUAL GREATER EQUAL DISEQ 
%left APPLY 
%right UNION 
%right INTER DIFF 
%nonassoc COMPL 
%left PLUS MINUS 
%left DIVIDE 
%left TIMES 
%right EXPT 
%right LISTCONS 
%right BVCONC 
%right BWXOR BWOR BWIMP 
%left BWIFF BWAND 
%nonassoc TO 
%nonassoc NOTIN IN 
%nonassoc LCUR 
%nonassoc LBRA 
%nonassoc COLON 
%nonassoc prec_unary 
%type <Atom.t> atomeof
%type <unit> commands
%type <unit> commandseof
%type <unit> commandsequence
%type <Prop.t> propeof
%type <Term.t> termeof
%%

termeof:
| term EOF
    { $1 }

atomeof:
| atom EOF
    { $1 }

propeof:
| prop EOF
    { $1 }

commandseof:
| command EOF
    { () }

commands:
| command DOT
    { () }
| EOF
    { raise End_of_file }

commandsequence:
| command DOT commandsequence
    { () }
| command DOT
    { () }
| EOF
    { raise End_of_file }

prop:
| LBRA prop RBRA
    { $2 }
| name
    { try Istate.prop_of $1 with Not_found -> Prop.mk_var $1 }
| atom
    { Prop.mk_poslit $1 }
| prop CONJ prop
    { Prop.mk_conj [$1; $3] }
| prop DISJ prop
    { Prop.mk_disj [$1; $3] }
| prop BIIMPL prop
    { Prop.mk_iff $1 $3 }
| prop XOR prop
    { Prop.mk_neg (Prop.mk_iff $1 $3) }
| prop IMPL prop
    { Prop.mk_disj [Prop.mk_neg $1; $3] }
| NEG prop %prec prec_unary
    { Prop.mk_neg $2 }
| IF prop THEN prop ELSE prop END
    { Prop.mk_ite $2 $4 $6 }

int:
| INTCONST
    { $1 }

rat:
| int
    { Q.of_int $1 }
| RATCONST
    { $1 }

name:
| IDENT
    { Name.of_string $1 }

namelist:
| name
    { [$1] }
| namelist COMMA name
    { $3 :: $1 }

term:
| var
    { $1 }
| app
    { $1 }
| LPAR term RPAR
    { $2 }
| arith
    { $1 }
| array
    { $1 }
| bv
    { $1 }
| product
    { $1 }
| boolean
    { $1 }
| coproduct
    { $1 }
| ics_list
    { $1 }
| apply
    { $1 }
| propset
    { $1 }

var:
| name
    { try
	    match Istate.entry_of $1 with
	      | Symtab.Def(Symtab.Term(a)) -> a
	      | Symtab.Type(c)  -> Term.Var.mk_var $1 c
	      | _ -> Term.Var.mk_var $1 Var.Cnstrnt.Unconstrained
	  with
	      Not_found -> Term.Var.mk_var $1 Var.Cnstrnt.Unconstrained }
| name LCUR cnstrnt RCUR
    { Term.Var.mk_var $1 $3 }

app:
| funsym LPAR termlist RPAR
    { Term.App.mk_app $1 (List.rev $3) }

funsym:
| name
    { Sym.Uninterp.make $1 }

ics_list:
| term LISTCONS term
    { Coproduct.mk_inj 1 (Product.mk_cons $1 $3) }
| HEAD LPAR term RPAR
    { Product.mk_car (Coproduct.mk_out 1 $3) }
| TAIL LPAR term RPAR
    { Product.mk_cdr (Coproduct.mk_out 1 $3) }
| NIL
    { Coproduct.mk_inj 0 (Bitvector.mk_eps()) }

apply:
| term APPLY term
    { Apply.mk_apply $1 $3 }
| S
    { Apply.mk_s () }
| K
    { Apply.mk_k () }
| I
    { Apply.mk_i () }
| C
    { Apply.mk_c () }
| LAMBDA namelist COLON term
    { let nl = $2 in   (* in reverse order! *)
				  let body = $4 in
				  let rec abstract_star acc = function
				    | [] -> assert false
				    | [n] -> Apply.abstract n acc
				    | n :: nl -> abstract_star (Apply.abstract n acc) nl
				  in 
				  abstract_star body nl }

boolean:
| TRUE
    { Boolean.mk_true() }
| FALSE
    { Boolean.mk_false() }

arith:
| rat
    { Arith.mk_num $1 }
| term PLUS term
    { Arith.mk_add $1 $3 }
| term MINUS term
    { Arith.mk_sub $1 $3 }
| MINUS term %prec prec_unary
    { Arith.mk_neg $2 }
| term TIMES term
    { Pprod.mk_mult $1 $3 }
| term EXPT int
    { Pprod.mk_expt $1 $3 }

product:
| CONS LPAR term COMMA term RPAR
    { Product.mk_cons $3 $5 }
| CAR LPAR term RPAR
    { Product.mk_car $3 }
| CDR LPAR term RPAR
    { Product.mk_cdr $3 }

coproduct:
| INL LPAR term RPAR
    { Coproduct.mk_inl $3 }
| INR LPAR term RPAR
    { Coproduct.mk_inr $3 }
| OUTL LPAR term RPAR
    { Coproduct.mk_outl $3 }
| OUTR LPAR term RPAR
    { Coproduct.mk_outr $3 }
| INJ LBRA INTCONST RBRA LPAR term RPAR
    { Coproduct.mk_inj $3 $6 }
| OUT LBRA INTCONST RBRA LPAR term RPAR
    { Coproduct.mk_out $3 $6 }

array:
| CREATE LPAR term RPAR
    { Funarr.mk_create $3 }
| term LBRA term ASSIGN term RBRA
    { Funarr.mk_update Term.is_equal $1 $3 $5 }
| term LBRA term RBRA
    { Funarr.mk_select Term.is_equal $1 $3 }

propset:
| EMPTY
    { Propset.mk_empty() }
| FULL
    { Propset.mk_full() }
| term UNION term
    { Propset.mk_union $1 $3 }
| term INTER term
    { Propset.mk_inter $1 $3 }
| COMPL term %prec prec_unary
    { Propset.mk_compl $2 }

bv:
| BVCONST
    { Bitvector.mk_const (Bitv.from_string $1)  }
| CONC LBRA INTCONST COMMA INTCONST RBRA LPAR term COMMA term RPAR
    { Bitvector.mk_conc $3 $5 $8 $10 }
| SUB LBRA INTCONST COMMA INTCONST COMMA INTCONST RBRA LPAR term RPAR
    { Bitvector.mk_sub $3 $5 $7 $10 }
| term BVCONC term
    { match Istate.width_of $1, Istate.width_of $3 with
	 | Some(n), Some(m) -> 
	     if n < 0 then
	       raise (Invalid_argument ("Negative length of " ^ Term.to_string $1))
	     else if m < 0 then
	       raise (Invalid_argument ("Negative length of " ^ Term.to_string $3))
	     else 
	       Bitvector.mk_conc n m $1 $3
	 | Some _, _ -> 
	     raise (Invalid_argument (Term.to_string $3 ^ " not a bitvector."))
	 | _ -> 
	     raise (Invalid_argument (Term.to_string $1 ^ " not a bitvector.")) }
| term LBRA INTCONST COLON INTCONST RBRA
    { match Istate.width_of $1 with
	 | Some(n) -> 
	     if n < 0 then
	       raise(Invalid_argument ("Negative length of " ^ Term.to_string $1))
	     else if not(0 <= $3 && $3 <= $5 && $5 < n) then
	       raise(Invalid_argument ("Invalid extraction from " ^ Term.to_string $1))
	     else 
	       Bitvector.mk_sub n $3 $5 $1
	 | None ->  
	     raise (Invalid_argument (Term.to_string $1 ^ " not a bitvector.")) }

atom:
| FF
    { Atom.mk_false }
| TT
    { Atom.mk_true }
| term EQUAL term
    { Atom.mk_equal ($1, $3) }
| term DISEQ term
    { Atom.mk_diseq ($1, $3) }
| term LESS term
    { Atom.mk_pos (Arith.mk_sub $3 $1) }
| term GREATER term
    { Atom.mk_pos (Arith.mk_sub $1 $3) }
| term LESSOREQUAL term
    { Atom.mk_nonneg (Arith.mk_sub $3 $1) }
| term GREATEROREQUAL term
    { Atom.mk_nonneg (Arith.mk_sub $1 $3) }
| term SUBSET term
    { Atom.mk_equal (Propset.mk_inter $1 $3, $1) }

dom:
| INT
    { Dom.Int }
| REAL
    { Dom.Real }

cnstrnt:
| dom
    { Var.Cnstrnt.Real($1) }
| signature
    { Var.Cnstrnt.Bitvector($1) }

termlist:
| 
    { [] }
| term
    { [$1] }
| termlist COMMA term
    { $3 :: $1 }

atomlist:
| 
    { [] }
| atom
    { [$1] }
| atomlist COMMA atom
    { $3 :: $1 }

signature:
| BV LBRA INTCONST RBRA
    { $3 }

command:
| CAN term
    { Istate.do_can $2 }
| SIMPLIFY atom
    { Istate.do_simplify $2 }
| ASSERT optname atom
    { Istate.do_process1 ($2, $3) }
| ASSERT optname atom COMMA atomlist
    { Istate.do_process ($2, $3 :: $5) }
| DEF name ASSIGN term
    { Istate.do_def ($2, (Symtab.Term($4))) }
| PROP name ASSIGN prop
    { Istate.do_prop ($2, $4) }
| SIG name COLON cnstrnt
    { Istate.do_typ ([$2], $4) }
| SIG namelist COLON cnstrnt
    { Istate.do_typ ($2, $4) }
| RESET
    { Istate.do_reset () }
| SAVE name
    { Istate.do_save(Some($2)) }
| SAVE
    { Istate.do_save(None) }
| RESTORE name
    { Istate.do_restore $2 }
| REMOVE name
    { Istate.do_remove $2 }
| FORGET
    { Istate.do_forget() }
| VALID optname atomlist
    { Istate.do_valid ($2, $3) }
| UNSAT optname atomlist
    { Istate.do_unsat ($2, $3) }
| EXIT
    { raise End_of_file }
| DROP
    { failwith "drop" }
| SYMTAB
    { Istate.do_symtab None }
| SYMTAB name
    { Istate.do_symtab (Some($2)) }
| CTXT optname
    { Istate.do_ctxt $2 }
| SIGMA term
    { Istate.do_sigma $2 }
| term CMP term
    { Istate.do_cmp ($1, $3) }
| SHOW optname
    { Istate.do_show $2 None }
| SHOW optname eqth
    { Istate.do_show $2 (Some($3)) }
| FIND optname eqth term
    { Istate.do_find ($2, $3, $4) }
| INV optname th term
    { Istate.do_inv ($2, $3, $4) }
| USE optname th term
    { Istate.do_dep ($2, $3, $4) }
| DOM optname term
    { Istate.do_dom ($2, $3) }
| DISEQ optname term
    { Istate.do_diseq ($2, $3) }
| SPLIT optname
    { Istate.do_split $2 }
| SOLVE th term EQUAL term
    { Istate.do_solve ($2, ($3, $5)) }
| TRACE identlist
    { Istate.do_trace $2 }
| UNTRACE
    { Istate.do_untrace None }
| UNTRACE identlist
    { Istate.do_untrace (Some($2)) }
| SAT optname prop
    { Istate.do_sat ($2, $3) }
| CHECK optname
    { Istate.do_check_sat $2 }
| MODEL optname optvarspecs
    { Istate.do_model ($2, List.rev $3) }
| ECHO STRING
    { Format.eprintf "%s@." $2 }
| GET varname
    { Istate.do_get $2 }
| varname ASSIGN value
    { Istate.do_set ($1, $3)}
| GET
    { Istate.do_show_vars () }
| SUP optname term
    { Istate.do_sup ($2, $3) }
| INF optname term
    { Istate.do_inf ($2, $3) }
| UNDO
    { Istate.do_undo () }
| help
    { $1 }

optvarspecs:
| 
    { [] }

varname:
| IDENT
    { Istate.Parameters.of_string $1 }

value:
| IDENT
    { $1 }
| TRUE
    { "true" }
| FALSE
    { "false" }

identlist:
| IDENT
    { [$1] }
| identlist COMMA IDENT
    { $3 :: $1 }

th:
| IDENT
    { Th.of_string $1 }

eqth:
| IDENT
    { try Some(Th.of_string $1)
    with exc -> if $1 = "v" then None else raise exc }

help:
| HELP
    { Istate.do_help Istate.All }
| HELP CAN
    { Istate.do_help (Istate.Command("can")) }
| HELP HELP
    { Istate.do_help (Istate.Command("help")) }
| HELP SIMPLIFY
    { Istate.do_help (Istate.Command("simplify")) }
| HELP ASSERT
    { Istate.do_help (Istate.Command("assert")) }
| HELP DEF
    { Istate.do_help (Istate.Command("def")) }
| HELP PROP
    { Istate.do_help (Istate.Command("prop")) }
| HELP SIG
    { Istate.do_help (Istate.Command("sig")) }
| HELP RESET
    { Istate.do_help (Istate.Command("reset")) }
| HELP SAVE
    { Istate.do_help (Istate.Command("save")) }
| HELP RESTORE
    { Istate.do_help (Istate.Command("restore")) }
| HELP REMOVE
    { Istate.do_help (Istate.Command("remove")) }
| HELP FORGET
    { Istate.do_help (Istate.Command("forget")) }
| HELP VALID
    { Istate.do_help (Istate.Command("valid")) }
| HELP UNSAT
    { Istate.do_help (Istate.Command("unsat")) }
| HELP EXIT
    { Istate.do_help (Istate.Command("exit")) }
| HELP DROP
    { Istate.do_help (Istate.Command("drop")) }
| HELP SYMTAB
    { Istate.do_help (Istate.Command("symtab")) }
| HELP CTXT
    { Istate.do_help (Istate.Command("ctxt")) }
| HELP SIGMA
    { Istate.do_help (Istate.Command("sigma")) }
| HELP CMP
    { Istate.do_help (Istate.Command("cmp")) }
| HELP SHOW
    { Istate.do_help (Istate.Command("show")) }
| HELP FIND
    { Istate.do_help (Istate.Command("find")) }
| HELP INV
    { Istate.do_help (Istate.Command("inv")) }
| HELP USE
    { Istate.do_help (Istate.Command("use")) }
| HELP DOM
    { Istate.do_help (Istate.Command("dom")) }
| HELP DISEQ
    { Istate.do_help (Istate.Command("diseq")) }
| HELP SPLIT
    { Istate.do_help (Istate.Command("split")) }
| HELP SOLVE
    { Istate.do_help (Istate.Command("solve")) }
| HELP TRACE
    { Istate.do_help (Istate.Command("trace")) }
| HELP UNTRACE
    { Istate.do_help (Istate.Command("untrace")) }
| HELP SAT
    { Istate.do_help (Istate.Command("sat")) }
| HELP MODEL
    { Istate.do_help (Istate.Command("model")) }
| HELP CHECK
    { Istate.do_help (Istate.Command("check")) }
| HELP ECHO
    { Istate.do_help (Istate.Command("echo")) }
| HELP GET
    { Istate.do_help (Istate.Command("get")) }
| HELP SUP
    { Istate.do_help (Istate.Command("sup")) }
| HELP INF
    { Istate.do_help (Istate.Command("inf")) }
| HELP ASSIGN
    { Istate.do_help (Istate.Command("set")) }
| HELP LESS IDENT GREATER
    { Istate.do_help (Istate.Nonterminal($3)) }
| HELP UNDO
    { Istate.do_help (Istate.Command("undo")) }

optname:
| 
    { None }
| KLAMMERAFFE name
    { Some($2) }

%%