Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fine Grained Module Definitions #661

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

Cameron-Low
Copy link
Contributor

@Cameron-Low Cameron-Low commented Nov 28, 2024

The goal of this PR is to introduce a new mechanism that permits the user to create a new module by slightly tweaking an existing module definition.

At present the draft has the following features:

  • Introduce new module variables.
  • Introduce new local variables.
  • Delete/Modify/Add statements at particular code positions
  • Delete branches (match support is not currently working fully)
  • Modify branch conditions
  • Insert new branches around a chunk of code
  • Modify the return expression

Syntax (needs work) :

module N = M with {
  var x : t (* add new module variable *)
  proc f [
     var y  : s (* add new local variable *)
     cp +/-/~ { s } (* insert after/insert before/modify a statement *)
     cp -  (* delete a statement *)
     cp + ( e ) (* insert new if statement with condition `e` surrounding the suffix code block *)
     cp - ./?/#cstr (* delete all other branches except true/false/cstr *)
  ] res ~ ( e ) (* change the return expression *)
}

- statement modification
- condition modification
- return expression modification
@fdupress
Copy link
Member

Can you please edit the message above to add syntax for each of the transformations? This will help in reviewing, independently of also creating a wiki page.

Ideas for a later piece of work:
- support for adding local variables;
- support for specifying transformations as opposed to their result
  ('Game1 is Game2 with key generation and challenge encryption inlined,
  and ...'; or 'the OWr game is Game2 with the reduction outlined')
@fdupress fdupress force-pushed the fine-grained-module-defs branch from 84ab24d to b588f39 Compare November 29, 2024 11:12
@Cameron-Low Cameron-Low marked this pull request as ready for review December 5, 2024 17:12
@Cameron-Low
Copy link
Contributor Author

This is now ready for review. I've made a wiki page to document the features present.

@Cameron-Low Cameron-Low requested review from strub and fdupress December 5, 2024 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants