erick-alcachofa de58de2a9a
fix(grammar): Correct ambiguities and restructure expression parsing
Signed-off-by: erick-alcachofa <erick@artichoke.dev>

The grammar contained several structural issues and ambiguities,
particularly in expression parsing, operator precedence, and the
`export` keyword. This commit restructures significant parts of the
grammar to resolve these problems and improve its formal correctness,
making it more suitable for parser generation.

The most relevant changes include:

* **Centralized Export Handling:** Corrects the definition of exports by
  introducing a top-level `<declaration>` rule that distinguishes
  between `<exportable_declaration>` and `<non_exportable_declaration>`.
  This removes the repetitive and ambiguous `export?` prefix from
  multiple individual declarations (`module`, `struct`, `fn`, etc.).

* **Unified Postfix Operations:** Integrates scoped access into the
  suffix operations . This provides an unambiguous and unified
  definition for these common constructs.

* **Updated Identifier Chain Issue:** Several rules in the precedence
  chain ultimately resolved into starting with an identifier, this
  caused ambiguitiy and issues for parsing, this was refactored in order
  to correctly handle the cases.

* **Reduced Ambiguity in Statements:** Refactors complex rules like
  `<variable_declaration>` and `<else_statement>` into smaller, more
  explicit sub-rules (`<variable_declaration_tail>`,
  `<else_statement_tail>`). This eliminates potential parsing conflicts
  and improves the overall clarity of the grammar.

* **Simplified Access Expressions:** Removes the separate
  `<scoped_access_expression>` and `<reflection_expression>` rules.
  Their logic has been integrated directly into the more generic and
  powerful postfix expression system, simplifying the grammar.
2025-10-11 11:30:27 -06:00
..
2025-10-02 00:26:35 -06:00