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

Preprocess contracts for ULM #189

Merged
merged 7 commits into from
Nov 25, 2024
Merged

Preprocess contracts for ULM #189

merged 7 commits into from
Nov 25, 2024

Conversation

virgil-serbanuta
Copy link
Member

@virgil-serbanuta virgil-serbanuta commented Nov 18, 2024

This continues my attempt to merge the ulm-virgil changes into the main semantics. However, instead of fully dropping the ULM preprocessing semantics, I am attempting to use it "the proper way".

@virgil-serbanuta virgil-serbanuta force-pushed the preprocess-contracts branch 3 times, most recently from f040425 to 5f6fd45 Compare November 20, 2024 13:47
@virgil-serbanuta virgil-serbanuta force-pushed the preprocess-contracts branch 2 times, most recently from 7cff1cc to 4a259b4 Compare November 22, 2024 17:29
@virgil-serbanuta virgil-serbanuta marked this pull request as ready for review November 25, 2024 15:10
Copy link

@sskeirik sskeirik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all makes sense and looks good.

I left one minor comment.

Comment on lines 1 to 43
from __future__ import annotations

import sys
from pathlib import Path
from typing import TYPE_CHECKING

from pyk.kore.parser import App, KoreParser

if TYPE_CHECKING:
from pyk.kore.syntax import Pattern


def descend(patt: Pattern, path: list[str]) -> Pattern:
for s in path:
if not isinstance(patt, App):
raise ValueError(type(patt))
new_patt: Pattern | None = None
for p in patt.args:
if isinstance(p, App):
print(p.symbol, s)
if p.symbol == s:
new_patt = p
break
if new_patt is None:
raise ValueError(patt.symbol)
patt = new_patt
return patt


def main(args: list[str]) -> None:
if len(args) != 2:
raise ValueError(args)
input_kore = Path(args[0]).read_text()
config = KoreParser(input_kore).pattern()
config = descend(
config,
["Lbl'-LT-'ulm-full-preprocessed'-GT-'"],
)
Path(args[1]).write_text(config.text)


if __name__ == '__main__':
main(sys.argv[1:])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this file isn't needed on this branch anymore --- do you think it is worth keeping around?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not, removed.

@virgil-serbanuta virgil-serbanuta merged commit b1a7d94 into main Nov 25, 2024
3 checks passed
@virgil-serbanuta virgil-serbanuta deleted the preprocess-contracts branch November 25, 2024 21:06
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.

2 participants