Skip to content

Parentheses supported by lexer but ignored by parser #7

@SAMBA8695

Description

@SAMBA8695

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions