-
Notifications
You must be signed in to change notification settings - Fork 4
Parentheses supported by lexer but ignored by parser #7
Copy link
Copy link
Open
Description
Bug Report: Parser Does Not Handle Parentheses
Description
The lexer recognizes left and right parentheses tokens (( and )), but the parser currently ignores them entirely.
As a result, expressions that rely on parentheses for grouping are parsed incorrectly or fail to parse.
Example Input
let x = (1 + 2) * 3;
Although the lexer produces TOKEN_LPAREN and TOKEN_RPAREN, the parser never consumes or handles these tokens.
Current Behavior
- Parentheses tokens are generated by the lexer
- Parser does not handle
(or) - Grouped expressions are not supported
- Expression evaluation order cannot be controlled by the user
Example
let x = (1 + 2);
Results in incorrect parsing or failure.
Expected Behavior
- Parentheses should allow explicit expression grouping
- Expressions inside parentheses should be parsed recursively
- Parser should consume matching
(and)tokens - Nested parentheses should be supported
Suggested Direction
- Extend expression parsing to recognize
(and) - On encountering
(, recursively parse an expression - Ensure closing
)is required and validated - Integrate with future operator precedence handling
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels