-
Notifications
You must be signed in to change notification settings - Fork 400
chore(experimental): Add scan pass and into_expression for comptime interpreter
#4884
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
Merged
Merged
Changes from 30 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
237418f
Add Hir -> Ast conversion
88fbae4
Move file
d4512ac
Add Hir -> Ast pass
dd05c5f
Merge branch 'master' into jf/hir-to-ast
064a074
Add weird attributes field even though it was compiling locally witho…
99b7839
Start work on interpreter
2232793
Evaluate if exprs
1c649e5
Update interpreter
b5bdb9c
Start evaluating statements
65a0da9
Fix compiler errors
9d5517b
Implement loops
9a31f68
Finish each node; still needs cleanup & testing
4247e89
Fix mutation after scopes were added
7121ec7
Implement function scopes
65fc2e1
clippy
20ac4e9
Merge branch 'master' into jf/interpreter
2bf6ea7
Add comptime expression & statement
a901d8f
Add comptime hir node
3443545
Handle comptime node in comptime module
55c28b4
Add case to tooling
3d08598
Merge branch 'master' into jf/comptime
9ebf902
Fix merge
4e4f9fd
Add missed case
824c4b2
Remove comptime from parse tests
63fdb4a
Add scanning pass
e376121
Refactor name resolution a bit
65f6513
Add into_expression
11a6acd
Finish fleshing out into_expression
jfecher b39f42b
Fix many many merge conflicts
jfecher a4e596e
fmt
jfecher 7e75b64
Code review
jfecher 3863ff2
Move unwrap; add comment
jfecher 80e64d2
Revert CompTime back to Comptime
jfecher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| use crate::{node_interner::DefinitionId, Type}; | ||
| use acvm::FieldElement; | ||
| use noirc_errors::Location; | ||
|
|
||
| use super::value::Value; | ||
|
|
||
| /// The possible errors that can halt the interpreter. | ||
| #[allow(unused)] | ||
| #[derive(Debug)] | ||
| pub(crate) enum InterpreterError { | ||
| ArgumentCountMismatch { expected: usize, actual: usize, call_location: Location }, | ||
| TypeMismatch { expected: Type, value: Value, location: Location }, | ||
| NoValueForId { id: DefinitionId, location: Location }, | ||
| IntegerOutOfRangeForType { value: FieldElement, typ: Type, location: Location }, | ||
| ErrorNodeEncountered { location: Location }, | ||
| NonFunctionCalled { value: Value, location: Location }, | ||
| NonBoolUsedInIf { value: Value, location: Location }, | ||
| NonBoolUsedInConstrain { value: Value, location: Location }, | ||
| FailingConstraint { message: Option<Value>, location: Location }, | ||
| NoMethodFound { object: Value, typ: Type, location: Location }, | ||
| NonIntegerUsedInLoop { value: Value, location: Location }, | ||
| NonPointerDereferenced { value: Value, location: Location }, | ||
| NonTupleOrStructInMemberAccess { value: Value, location: Location }, | ||
| NonArrayIndexed { value: Value, location: Location }, | ||
| NonIntegerUsedAsIndex { value: Value, location: Location }, | ||
| NonIntegerIntegerLiteral { typ: Type, location: Location }, | ||
| NonIntegerArrayLength { typ: Type, location: Location }, | ||
| NonNumericCasted { value: Value, location: Location }, | ||
| IndexOutOfBounds { index: usize, length: usize, location: Location }, | ||
| ExpectedStructToHaveField { value: Value, field_name: String, location: Location }, | ||
| TypeUnsupported { typ: Type, location: Location }, | ||
| InvalidValueForUnary { value: Value, operator: &'static str, location: Location }, | ||
| InvalidValuesForBinary { lhs: Value, rhs: Value, operator: &'static str, location: Location }, | ||
| CastToNonNumericType { typ: Type, location: Location }, | ||
| QuoteInRuntimeCode { location: Location }, | ||
| NonStructInConstructor { typ: Type, location: Location }, | ||
| CannotInlineMacro { value: Value, location: Location }, | ||
| UnquoteFoundDuringEvaluation { location: Location }, | ||
|
|
||
| Unimplemented { item: &'static str, location: Location }, | ||
|
|
||
| // Perhaps this should be unreachable! due to type checking also preventing this error? | ||
| // Currently it and the Continue variant are the only interpreter errors without a Location field | ||
| BreakNotInLoop, | ||
| ContinueNotInLoop, | ||
|
|
||
| // These cases are not errors but prevent us from running more code | ||
| // until the loop can be resumed properly. | ||
| Break, | ||
| Continue, | ||
|
jfecher marked this conversation as resolved.
|
||
| } | ||
|
|
||
| #[allow(unused)] | ||
| pub(super) type IResult<T> = std::result::Result<T, InterpreterError>; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.