This PR adds support for the >=, <=, != operators to ThinkPy, enhancing our comparison capabilities particularly for educational examples like grade calculations.
Changes Made
Added GREATER_EQUALS, LESS_EQUALS, NOT_EQUALS tokens and patterns to lexer
Updated parser grammar for operators
Added operator precedence rules
Implemented operator evaluation in interpreter
Example
Before:
# Workaround for >= 90
if score > 89 then
grade = "A"
After:
# Direct and intuitive
if score >= 90 then
grade = "A"
Testing
Need to add tests for:
Basic integer comparisons
Floating point comparisons
Complex decision structures
Operator precedence
Error handling
NEED to add Documentation
Update language reference with >= operator
Add examples in educational materials
Update style guide
Related Issue
Closes #18
Checklist
[x] Code follows ThinkPy style guide
[ ] Added/updated tests
[ ] Updated documentation
[ ] All tests passing
[x] Reviewed by maintainer
[x] No regression issues
Screenshots
[If relevant, add screenshots showing the operator in use]
Description
This PR adds support for the >=, <=, != operators to ThinkPy, enhancing our comparison capabilities particularly for educational examples like grade calculations.
Changes Made
Example
Before:
After:
Testing
Need to add tests for:
NEED to add Documentation
Related Issue
Closes #18
Checklist
Screenshots
[If relevant, add screenshots showing the operator in use]
Notes for Reviewers
Please pay special attention to:
Breaking Changes
None. This is a backward-compatible enhancement.