Commit Graph

9 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto ee30d1d0f8 mruby-compiler: allow at-least-once loop behavior for mruby
mruby does not provide `begin ... end while cond` that behave at-least-once
loop, like CRuby does. It remains in TODO.md for long time. But finally we have
implemented the behavior.
2025-07-11 10:09:34 +09:00
Yukihiro "Matz" Matsumoto ebc10f3c57 Add NODE_BEGIN for explicit begin...end blocks
This commit introduces NODE_BEGIN as a distinct AST node type for
explicit begin...end blocks, separate from NODE_STMTS which represents
general statement sequences. This distinction will be essential for
implementing CRuby-compatible begin...end while/until constructs.

Key changes:
- Added NODE_BEGIN enum in node.h
- Added new_begin() function in parse.y using optimized cons() structure
- Modified begin...end grammar rule to generate NODE_BEGIN nodes
- Added NODE_BEGIN codegen support in codegen.c
- Added NODE_BEGIN to parser dump functionality

NODE_BEGIN uses a simpler cons() structure instead of list2() for
better memory efficiency, as it only contains a single body node.

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-11 10:09:34 +09:00
Yukihiro "Matz" Matsumoto f6c166cbb0 mruby-compiler: rename NODE_BEGIN to NODE_STMTS for clarity
Rename NODE_BEGIN to NODE_STMTS to better reflect its purpose as a
container for statement sequences, not specifically begin-end blocks.
This prepares for adding a dedicated node type for explicit begin-end
constructs.

- Rename NODE_BEGIN enum to NODE_STMTS in node.h
- Update all references in parse.y and codegen.c
- Rename new_begin function to new_stmts

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-11 10:09:33 +09:00
Ukrainskiy Sergey 72d57ad094 Implement numbered parameters 2019-12-09 20:50:41 +09:00
Yukihiro "Matz" Matsumoto b06dad43fa Remove unused NODE_* constants from node.h. 2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto 8c9e712784 Keyword argument implemented. 2018-07-30 22:58:01 +09:00
Yukihiro "Matz" Matsumoto 21a3ae08f7 add safe-navigation (aka lonely) operator &. 2016-03-23 08:51:25 +09:00
Yasuhiro Matsumoto f0205e1182 rename include blocker 2015-12-25 13:43:01 +09:00
take_cheeze 6460ef77bc Compile mruby compiler as mrbgem.
Compiler codes is moved to "mruby-compiler".
Executable `mrbc` is moved to "mruby-bin-mrbc".
2015-06-01 21:53:55 +09:00