Skip to content

Commit e2fa222

Browse files
committed
SMV: grammar for self expression
This adds the grammar for parsing self expressions. They are rejected by the type checker as unsupported.
1 parent 4f930c8 commit e2fa222

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

regression/smv/modules/self1.desc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
KNOWNBUG
1+
CORE
22
self1.smv
33

4-
^EXIT=0$
4+
^file .* line 4: no support for self$
5+
^EXIT=2$
56
^SIGNAL=0$
67
--
78
^warning: ignoring
89
--
9-
This does not parse.

src/hw_cbmc_irep_ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ IREP_ID_TWO(C_smv_iff, "#smv_iff")
3636
IREP_ID_ONE(smv_range)
3737
IREP_ID_ONE(smv_resize)
3838
IREP_ID_ONE(smv_toint)
39+
IREP_ID_ONE(smv_self)
3940
IREP_ID_ONE(smv_set)
4041
IREP_ID_ONE(smv_setin)
4142
IREP_ID_ONE(smv_setnotin)

src/smvlang/parser.y

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,11 @@ basic_expr : constant
738738
unary($$, ID_member, $1);
739739
stack_expr($$).set(ID_component_name, stack_expr($3).id());
740740
}
741+
| self_Token
742+
{
743+
// This rule is part of "complex_identifier" in the NuSMV manual.
744+
init($$, ID_smv_self);
745+
}
741746
| basic_expr '(' basic_expr ')'
742747
{
743748
// Not in the NuSMV grammar.

src/smvlang/smv_typecheck.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1928,6 +1928,11 @@ void smv_typecheckt::convert(exprt &expr)
19281928
tmp.set_identifier(id2string(tmp.get_identifier()) + '.' + index_string);
19291929
expr = tmp;
19301930
}
1931+
else if(expr.id() == ID_smv_self)
1932+
{
1933+
throw errort().with_location(expr.source_location())
1934+
<< "no support for self";
1935+
}
19311936
else if(expr.id()=="smv_nondet_choice" ||
19321937
expr.id()=="smv_union")
19331938
{

0 commit comments

Comments
 (0)