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

[python-frontend] Operational model for int.from_bytes() #1843

Merged
merged 30 commits into from
May 20, 2024

Conversation

brcfarias
Copy link
Collaborator

@brcfarias brcfarias commented May 18, 2024

>> int.from_bytes(b'\x00\x10', byteorder='big')
16
  • Given that the frontend still doesn't support strings, the AST is being manipulated to replace the "byteorder" parameter with a boolean "is_bigendian".
  • "bytes" array data is being encoded in base64 because json.dump() adds escape characters for non-printable ASCII characters. Additionally, in some cases it was not possible to diferentiate text from numerical values (e.g. "AAFF"). Now, "bytes" data is encoded in base64, and we store the corresponding int value after decoding in python_converter.
  • Adding new "consensus" type mappings.

regression/python/int_from_bytes/main.py Outdated Show resolved Hide resolved
src/python-frontend/models/int.py Show resolved Hide resolved
src/python-frontend/preprocessor.py Show resolved Hide resolved
src/python-frontend/python_converter.cpp Outdated Show resolved Hide resolved
src/python-frontend/python_converter.cpp Show resolved Hide resolved
src/python-frontend/python_converter.cpp Show resolved Hide resolved
src/python-frontend/python_converter.cpp Show resolved Hide resolved
Copy link
Contributor

@lucasccordeiro lucasccordeiro left a comment

Choose a reason for hiding this comment

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

Thanks for submitting this PR, @brcfarias.

@lucasccordeiro lucasccordeiro merged commit 602c8d6 into esbmc:master May 20, 2024
10 of 11 checks passed
@brcfarias brcfarias deleted the python-frontend branch May 20, 2024 15:10
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.

None yet

2 participants