Skip to content

Fix issue #21: Improve syntax validation and error messages#40

Open
jaybutani1793 wants to merge 4 commits intokovzol:masterfrom
jaybutani1793:fix-issue-21-validation
Open

Fix issue #21: Improve syntax validation and error messages#40
jaybutani1793 wants to merge 4 commits intokovzol:masterfrom
jaybutani1793:fix-issue-21-validation

Conversation

@jaybutani1793
Copy link
Copy Markdown
Contributor

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

  • Added pre-validation step to detect incomplete expressions (e.g., dangling connectives like "P v")
  • Added detection for invalid or unsupported symbols (e.g., "$", "%", "@", "#")
  • Improved error messages to be more descriptive and user-friendly
  • Included line number in error messages for better debugging

Implementation Details

  • Introduced check_raw_connective_usage() to detect common typing mistakes before parsing
  • Updated sen_data_evaluate() to:
    • Perform pre-validation on raw input
    • Return specific error messages with line numbers
    • Handle different syntax error types more clearly

Result

  • Clear and precise error messages
  • Better user feedback during proof construction
  • Prevents misleading or vague syntax errors

Testing

Tested manually with the following cases:

  1. Input: P v
    → Error: "Line X: Syntax error: connective missing operand"

  2. Input: P $
    → Error: "Line X: Syntax error: invalid symbol or malformed expression"

  3. Input: P v Q
    → Valid (no error)

  4. Input: (P v Q
    → Error: mismatched parentheses

jaybutani1793 and others added 4 commits March 23, 2026 08:55
- 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
Copy link
Copy Markdown
Contributor Author

@jaybutani1793 jaybutani1793 left a comment

Choose a reason for hiding this comment

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

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.

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.

1 participant