-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: Validation of AST #26
Merged
Merged
Conversation
This file contains 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
Closed
Part of #25 This validator does nothing for now, it just throw for each expression.
Gashmob
force-pushed
the
25-validation-of-ast
branch
from
August 23, 2024 16:23
419ecfc
to
9bec4f7
Compare
Part of #25 It will be used to store context of ValidationVisitor easily. Instead of creating a new member each time, just store it directly in the context. The stack/unstack allow to have a different context if we need it
Part of #25 It will help to show understandable message
Part of #25 It helps to format message shown to user
Part of #25 Show a warning if value not used
Part of #25 Instead of using a pointer to parent, use std::stack of map. There is at least one map in the stack (unstack cannot pop last map).
Part of #25 It set type of expressions (just literals for now) and check that last expression is an int (return type of program)
Part of #25 - Check constant has a value - Check declared type (if exists) - Check assigned value (if exists) - Check assigned value == declared type (if exists) - Check existence of at least type or value
Part of #25 - check name exists
Part of #25 - check name exists - check it's not a constant - check type equality
Part of #25 - check left operand - check right operand - check calcul can be done between types Also add early return when type given by sub-expression is nullptr: it means there is an error, so no need to go further in this expression
Part of #25 It ease the dump of types when it's aliased types
Part of 25 This public method tells if there was an error during validation. To do so it just checks if a call to displayError was made (if so it means there was an error). displayWarning is not considered as an error
Part of #25 All cases are covered (at least all I can think of)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #25