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

kompilex command for pyk #4342

Merged
merged 22 commits into from
May 21, 2024
Merged

kompilex command for pyk #4342

merged 22 commits into from
May 21, 2024

Conversation

gtrepta
Copy link
Contributor

@gtrepta gtrepta commented May 13, 2024

Implements the command pyk kompilex which uses pyk's outer parser to parse in a K Definition and then hands it off to the java frontend to handle the rest of the compilation.

Some bootstrapping is required because the conversions from the outer parsed structures to something compatible with the java frontend aren't fully implemented. For the integration tests, a prelude-modules.json file is included in the test data folder which has the K prelude already outer parsed.

This will only handle modules that are empty or import other modules. The goal is to expand this capability until the full K language is supported, and then the bootstrapping will no longer be necessary.

Some attributes in the bootstrapped prelude modules that the java frontend emits are
dictionaries, which get loaded in as FrozenDict's by KAtt.from_dict.
When attempting to reserialize these an encoder is needed for json.dumps
to support them.
@gtrepta gtrepta marked this pull request as ready for review May 14, 2024 12:36
@ehildenb
Copy link
Member

We should probably make sure this plays nicely with: #4345

pyk/src/pyk/utils.py Outdated Show resolved Hide resolved
pyk/src/tests/integration/test_pyk.py Outdated Show resolved Hide resolved
pyk/src/tests/integration/test-data/prelude-modules.json Outdated Show resolved Hide resolved
pyk/src/pyk/kast/att.py Outdated Show resolved Hide resolved
pyk/src/pyk/__main__.py Show resolved Hide resolved
pyk/src/pyk/__main__.py Outdated Show resolved Hide resolved
@gtrepta gtrepta requested a review from tothtamas28 May 16, 2024 22:21
pyk/src/pyk/cli/args.py Outdated Show resolved Hide resolved
pyk/src/pyk/__main__.py Outdated Show resolved Hide resolved
Comment on lines 438 to 439
_LOGGER.critical(e)
exit(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can just let the exception propagate to the output instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds fine for now. There are a variety of user errors here that can cause an exception and I would eventually like to see these exceptions be collected and logged somehow for the user instead of having python die and show them a stack trace.

@rv-jenkins rv-jenkins merged commit d3cfd89 into develop May 21, 2024
17 checks passed
@rv-jenkins rv-jenkins deleted the pyk/kompilex branch May 21, 2024 19:42
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.

None yet

5 participants