Skip to content

Checks for multiple init and next blocks and throws a parser error if encountered#262

Merged
polgreen merged 2 commits into
masterfrom
multiple_blocks
Jul 9, 2025
Merged

Checks for multiple init and next blocks and throws a parser error if encountered#262
polgreen merged 2 commits into
masterfrom
multiple_blocks

Conversation

@polgreen

@polgreen polgreen commented Jul 8, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@polgreen

polgreen commented Jul 8, 2025

Copy link
Copy Markdown
Contributor Author

@kkmc I've disabled the code that combines init blocks in this PR, because the order they were combined in if there were two blocks written in the same module in the input file seemed to be nondeterministic

e.g., this passes:

module main {
  var x : integer;

  init {
    x = 1;
  }

  init {
    x = 0;
  }

  invariant prop_eq: x == 0;

  control {
    v = bmc(5);
    check;
    print_results;
  }
}

and this passes:

module main {
  var x : integer;

  init {
    x = 0;
  }

  init {
    x = 1;
  }

  invariant prop_eq: x == 0;

  control {
    v = bmc(5);
    check;
    print_results;
  }
}

But this does not:

module main {
  var x : integer;

  init {
    x=0;
    x = 1;
  }

  invariant prop_eq: x == 0;

  control {
    v = bmc(5);
    check;
    print_results;
  }
}

Do you need this code for the TAP proofs? If so, we need to figure out how to combine the init blocks in the order they are parsed in

polgreen added 2 commits July 8, 2025 17:08
Remove code that picks only one init block when combining modules

this was previously misleading because the order the init block statements were combined in isn't obvious to the user.
@polgreen polgreen merged commit a4e4e7a into master Jul 9, 2025
2 checks passed
@polgreen polgreen deleted the multiple_blocks branch July 9, 2025 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant