Fix issue #21: Improve syntax validation and error messages#40
Open
jaybutani1793 wants to merge 4 commits intokovzol:masterfrom
Open
Fix issue #21: Improve syntax validation and error messages#40jaybutani1793 wants to merge 4 commits intokovzol:masterfrom
jaybutani1793 wants to merge 4 commits intokovzol:masterfrom
Conversation
- Reject invalid symbols like '$' - Reject incomplete expressions like 'P v' - Allow valid expressions like 'P v Q' - Improved error messages
- Reject invalid symbols like '$' - Reject incomplete expressions like 'P v' - Allow valid expressions like 'P v Q' - Improved error handling
jaybutani1793
commented
Mar 29, 2026
Contributor
Author
jaybutani1793
left a comment
There was a problem hiding this comment.
Thanks! I added more detailed syntax error messages, improved handling using switch cases, and ensured proper memory cleanup. This should improve clarity and user feedback.
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
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.
Fix issue #21: Improve syntax validation and error reporting
Problem
The current syntax validation provides generic error messages and does not clearly indicate the exact issue in malformed expressions. In some cases, incomplete expressions like "P v" or invalid symbols are not handled clearly.
Solution
Implementation Details
check_raw_connective_usage()to detect common typing mistakes before parsingsen_data_evaluate()to:Result
Testing
Tested manually with the following cases:
Input:
P v→ Error: "Line X: Syntax error: connective missing operand"
Input:
P $→ Error: "Line X: Syntax error: invalid symbol or malformed expression"
Input:
P v Q→ Valid (no error)
Input:
(P v Q→ Error: mismatched parentheses