hhu-stups / prob-issues

ProB issues (for probcli, ProB Tcl/Tk, ProB2, ProB2UI)
6 stars 0 forks source link

Support ELSIF for predicates #315

Open leuschel opened 1 year ago

leuschel commented 1 year ago

Example:

>>> IF x=1 THEN y>2 ELSIF x=2 THEN y>4 ELSE y>3 END & x:1..10 & y<6
! [1,17] expecting: 'ELSE'
! Line: 1 Column: 16 until Line: 1 Column: 21

### IF x=1 THEN y>2 ELSIF x=2 THEN y>4 ELSE y>3 END & x:1..10 & y<6 
###                 ^^^^^
Not a valid expression or predicate
dgelessus commented 1 year ago

Also, it seems that the IF-THEN-ELSE predicate is translated in the parser to two implications, duplicating the left-hand side. We should probably generate an if-then-else predicate instead.

This is easy to change in the parser, but the Prolog side needs to be adjusted first to handle if_predicate nodes.

iTitus commented 8 months ago

Implemented the parser part here: https://github.com/hhu-stups/probparsers/commit/51015934e5323f6786a5b90a4915f386694773cd Although it is still rewritten as implications.