Add if statements, unary minus, and fix GC safe points

- Lexer: recognize 'if' as keyword (TOK_IF)
- Parser: add NODE_IF with if_statement union, parse if/cond/body,
  handle unary minus in parse_term as 0 - expr
- Eval: add NODE_IF evaluation, move GC to NODE_BLOCK level to avoid
  destroying temporary values during sub-expression evaluation
This commit is contained in:
Jose Luis Montañes Ojados
2026-02-16 05:12:28 +01:00
parent 84b3abbfda
commit 65220f88c6
5 changed files with 64 additions and 11 deletions

4
projects/if.j Normal file
View File

@@ -0,0 +1,4 @@
x = 20
if x < 10:
print x
print -300