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

Rewriting constants #73

Merged
merged 6 commits into from
Sep 4, 2024
Merged

Rewriting constants #73

merged 6 commits into from
Sep 4, 2024

Conversation

ACassimiro
Copy link
Collaborator

Introducing constant lookup at preprocessing time.

@@ -60,7 +60,7 @@ def exec_run(options: RunOptions) -> None:
print('Performed all possible rewriting operations; Trying to fetch the content of the K cell.')

module_manager.print_k_top_element()

Copy link
Member

Choose a reason for hiding this comment

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

Empty space change, it may be worth removing.

fn lookup_constant(&self) -> u64 { YEARLY_INTEREST }

fn lookup_constant_with_type(&self) -> u64 {
let x = YEARLY_INTEREST::u64;
Copy link
Member

Choose a reason for hiding this comment

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

Does this actually work if you try to compile it with rustc? Shouldn't this be let x = YEARLY_INTEREST;?


fn lookup_constant_with_type(&self) -> u64 {
let x = YEARLY_INTEREST::u64;
x }
Copy link
Member

Choose a reason for hiding this comment

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

New line after x?

@ACassimiro ACassimiro marked this pull request as draft September 3, 2024 19:07
@ACassimiro ACassimiro marked this pull request as ready for review September 3, 2024 19:22
@@ -24,5 +24,10 @@ module RUST-CONSTANTS
</constant>
...
</constants>

Copy link
Member

Choose a reason for hiding this comment

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

This rule should actually be in a new file, called rust-semantics/expression/constants.mx. This file (and its module) should be required/imported in the same places as rust-semantics/expression/literals.md, so that it will be used both for preprocessing and for execution.

@ACassimiro ACassimiro merged commit 4e187e5 into main Sep 4, 2024
1 check passed
@ACassimiro ACassimiro deleted the rewriting-constants branch September 4, 2024 18:08
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