mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
c5431ac293
Remove NODE_SCALL and NODE_FCALL node types, consolidating all method calls into a single NODE_CALL variable-sized node structure. This simplifies the AST by unifying call semantics while maintaining support for safe navigation and different call types through node flags. Key changes: - Convert call nodes to use variable-sized allocation with call_node structure - Unify new_call() and new_fcall() to create NODE_CALL nodes consistently - Replace gen_call() with separate gen_call_var() and gen_call_assign_var() - Add gen_call_assign_var() for assignment operations like h[k] = v - Remove legacy call handling from main codegen switch statement - Preserve argument structure using args pointer instead of unpacking - Support safe calls, keyword arguments, and blocks in unified structure This migration maintains backward compatibility while enabling more efficient call node processing and reduced code duplication in the compiler. 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