mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
af3817efb9
Migrated both NODE_BLOCK and NODE_LAMBDA to use variable-sized nodes exclusively while fixing compatibility issues with mixed node structures. Parser changes: - new_block() and new_lambda() always create variable-sized nodes - temporarily disabled var_nodes_enabled to avoid mixed node structure issues Codegen changes: - removed codegen_block() and codegen_lambda() functions - removed traditional NODE_BLOCK and NODE_LAMBDA cases from switch statement - inlined logic into gen_block_var() and gen_lambda_var() using stack-allocated structures - fixed lambda_body() to handle both variable-sized and cons-list NODE_ARGS_TAIL - restored OP_KEYEND generation logic for proper keyword argument validation All tests pass with improved memory efficiency through direct struct access. Co-authored-by: Claude <noreply@anthropic.com>
mruby-compiler
This mrbgem provides the mruby compiler, which is responsible for parsing Ruby code and generating mruby bytecode.
Functionality
The mruby-compiler gem includes the following components:
- Parser: Translates Ruby source code into an abstract syntax tree (AST).
- Code Generator: Traverses the AST to produce executable mruby bytecode.
mrbcexecutable: A command-line tool for compiling.rbfiles into.mrbbytecode files.
Usage
The mrbc (mruby-bin-mrbc) executable will generate compiled binary from Ruby
programs via this gem.
Example of using mrbc:
# Compile a Ruby script to bytecode
bin/mrbc my_script.rb
# Run the compiled script
bin/mruby my_script.mrb