Add block scoping and statement/expression distinction

Implement strict block scoping and distinguish between statements and
expressions.
This change introduces hierarchical scopes for functions and blocks,
enforces that `def` is a statement with no return value, and prevents
statements from appearing in expression positions or as the last element
of a block. A new example `design-flaw.myc` is added to demonstrate
the uninitialized variable issue solved by these changes.
This commit is contained in:
Michael Schimmel
2026-03-10 17:03:46 +01:00
parent 961168f3b6
commit 3b063dc2c9
3 changed files with 95 additions and 33 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
(do
(do
(def x "hh")
(if false (def x "hh"))
)
(print x)
)