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

replace TraceBindingAccess with SymbolAccess #258

Merged
merged 3 commits into from
Apr 18, 2023
Merged

replace TraceBindingAccess with SymbolAccess #258

merged 3 commits into from
Apr 18, 2023

Conversation

grjte
Copy link
Contributor

@grjte grjte commented Apr 18, 2023

This PR consolidates TraceBindingAccess into SymbolAccess. It aims to be as straightforward as possible without losing correctness, which means that some things are not fully addressed yet.

  • replaces TraceBindingAccess with SymbolAccess in the parser/IR/codegen
  • simplifies access errors in the IR, since some changes were required by the SymbolAccess handling changes anyway

Remaining items to address:

  • remove TraceAccess usage from parser. This will require some cleanup in the parser, so it will be done in a separate PR
  • handling of Slice access type. Previously this was only allowed for trace columns. I don't think there's a good reason not to allow this for variables/constants, but it needs to be done carefully. Similarly, within the ListComprehension we need to be careful about this, but because the ListComprehension is still quite complicated I think this should be revisited separately.
  • revisit expression handling to see if it can be further simplified
  • revisit list comprehension/folding to see if they can be simplified
  • once the IR changes are done, we need to do a thorough analysis to make sure that all required errors are being caught. I think it's likely there are things missing here or that things which were previously enforced by the parser are now being left for the IR (but not yet handled)

@grjte grjte requested review from Fumuran, bobbinth and tohrnii April 18, 2023 09:15
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you! I left a couple of non-blocking comments inline.

Comment on lines +26 to 33
Self::Constant(_) => write!(f, "ConstantBinding"),
Self::Trace(_) => {
write!(f, "TraceBinding")
}
Self::PublicInput(_) => write!(f, "PublicInput"),
Self::PeriodicColumn(_, _) => write!(f, "PeriodicColumn"),
Self::Variable(_) => write!(f, "Variable"),
Self::Variable(_) => write!(f, "VariableBinding"),
Self::RandomValues(_, _) => write!(f, "RandomValues"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: is there a reason why we sometimes add "Binding" at the end and sometimes don't?

Copy link
Contributor Author

@grjte grjte Apr 18, 2023

Choose a reason for hiding this comment

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

I think it's clearer in the errors if it has binding in it, but we don't ever refer to the other ones as bindings (even though they are). Not that this is a great reason - I prefer consistency too, but when I was looking at the errors I felt it was a little unclear without adding Binding

ir/src/symbol_table/symbol.rs Outdated Show resolved Hide resolved
ir/src/symbol_table/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@tohrnii tohrnii left a comment

Choose a reason for hiding this comment

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

Thanks @grjte, looks great.

air-script-core/src/access.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@Fumuran Fumuran left a comment

Choose a reason for hiding this comment

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

Looks great, thank you @grjte!

@grjte grjte force-pushed the grjte-refactor-2 branch from 50a4af7 to bf0cbdc Compare April 18, 2023 14:08
@grjte grjte merged commit 4d6090b into next Apr 18, 2023
@grjte grjte deleted the grjte-refactor-2 branch April 18, 2023 14:09
@grjte grjte mentioned this pull request Apr 21, 2023
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.

4 participants