@@ -41,7 +41,7 @@ class smv_typecheckt:public typecheckt
41
41
42
42
virtual ~smv_typecheckt () { }
43
43
44
- typedef enum { INIT, TRANS, OTHER } modet;
44
+ typedef enum { INIT, TRANS, OTHER, LTL, CTL } modet;
45
45
46
46
void convert (smv_parse_treet::modulet &smv_module);
47
47
void convert (smv_parse_treet::mc_varst &vars);
@@ -936,25 +936,35 @@ void smv_typecheckt::typecheck(
936
936
}
937
937
else if (
938
938
expr.id () == ID_AG || expr.id () == ID_AX || expr.id () == ID_AF ||
939
- expr.id () == ID_EG || expr.id () == ID_EX || expr.id () == ID_EF ||
940
- expr.id () == ID_X || expr.id () == ID_F || expr.id () == ID_G)
939
+ expr.id () == ID_EG || expr.id () == ID_EX || expr.id () == ID_EF)
941
940
{
942
- if (expr.operands ().size ()!=1 )
943
- {
944
- error ().source_location =expr.find_source_location ();
945
- error () << " Expected one operand for " << expr.id ()
946
- << " operator" << eom;
947
- throw 0 ;
948
- }
949
-
941
+ if (mode != CTL)
942
+ throw errort ().with_location (expr.source_location ()) << " CTL operator not permitted here" ;
943
+ expr.type ()=bool_typet ();
944
+ typecheck (to_unary_expr (expr).op (), expr.type (), mode);
945
+ }
946
+ else if (expr.id () == ID_X || expr.id () == ID_F || expr.id () == ID_G)
947
+ {
948
+ if (mode != LTL)
949
+ throw errort ().with_location (expr.source_location ()) << " LTL operator not permitted here" ;
950
950
expr.type ()=bool_typet ();
951
-
952
951
typecheck (to_unary_expr (expr).op (), expr.type (), mode);
953
952
}
954
953
else if (
955
954
expr.id () == ID_EU || expr.id () == ID_ER || expr.id () == ID_AU ||
956
- expr.id () == ID_AR || expr.id () == ID_U || expr.id () == ID_R)
955
+ expr.id () == ID_AR)
956
+ {
957
+ if (mode != CTL)
958
+ throw errort ().with_location (expr.source_location ()) << " CTL operator not permitted here" ;
959
+ auto &binary_expr = to_binary_expr (expr);
960
+ expr.type () = bool_typet ();
961
+ typecheck (binary_expr.lhs (), expr.type (), mode);
962
+ typecheck (binary_expr.rhs (), expr.type (), mode);
963
+ }
964
+ else if (expr.id () == ID_U || expr.id () == ID_R)
957
965
{
966
+ if (mode != LTL)
967
+ throw errort ().with_location (expr.source_location ()) << " LTL operator not permitted here" ;
958
968
auto &binary_expr = to_binary_expr (expr);
959
969
expr.type () = bool_typet ();
960
970
typecheck (binary_expr.lhs (), expr.type (), mode);
@@ -1194,11 +1204,17 @@ void smv_typecheckt::typecheck(
1194
1204
mode=TRANS;
1195
1205
break ;
1196
1206
1207
+ case smv_parse_treet::modulet::itemt::CTLSPEC:
1208
+ mode = CTL;
1209
+ break ;
1210
+
1211
+ case smv_parse_treet::modulet::itemt::LTLSPEC:
1212
+ mode = LTL;
1213
+ break ;
1214
+
1197
1215
case smv_parse_treet::modulet::itemt::DEFINE:
1198
1216
case smv_parse_treet::modulet::itemt::INVAR:
1199
1217
case smv_parse_treet::modulet::itemt::FAIRNESS:
1200
- case smv_parse_treet::modulet::itemt::CTLSPEC:
1201
- case smv_parse_treet::modulet::itemt::LTLSPEC:
1202
1218
default :
1203
1219
mode=OTHER;
1204
1220
}
0 commit comments