From 0e9995ce7ee1506043f82e8993f845b793cf2037 Mon Sep 17 00:00:00 2001 From: erick-alcachofa Date: Sun, 12 Oct 2025 18:58:27 -0600 Subject: [PATCH] feat(grammar): enhance aliases and for-loop initializers Signed-off-by: erick-alcachofa This commit updates the language grammar to expand the capabilities of `using` aliases and C-style `for` loops. It also refines where aliases can be declared. This changes are made after re-analizing the grammar while creating the AST node types. * **Aliases:** A `using` alias can now map to any valid ``, such as a pointer (`*i32`) or optional (`?string`), instead of just a simple ``. * **For Loops:** The initializer in a C-style `for` loop can now be a general `` (e.g., `i = 0`) in addition to a full ``. * **Scope:** Alias declarations are now restricted to the top level (declarations) and are no longer permitted as statements inside function bodies. BREAKING CHANGE: Alias declarations (`using`) are no longer valid inside function bodies and must be declared at a module or global scope. --- docs/grammar.ebnf | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/grammar.ebnf b/docs/grammar.ebnf index 1b881c6..a99b01b 100644 --- a/docs/grammar.ebnf +++ b/docs/grammar.ebnf @@ -48,7 +48,7 @@ non_exportable_declaration = ( "::" "*" )? = - "using" "=" ";" + "using" "=" ";" /* --- Declarations --- */ @@ -106,7 +106,6 @@ non_exportable_declaration = | ";" | ";" | ";" - | | | | @@ -147,7 +146,7 @@ non_exportable_declaration = ) = - "for" "(" ? ";" ";" ? ")" + "for" "(" ( | )? ";" ";" ? ")" =