mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
f4fe87c11e
These node types always generate variable-sized nodes, so the cons-list codegen support is no longer needed. This change: codegen.c: - Moves logic from codegen_break/next/redo/retry into gen_*_var functions - Removes cons-list switch cases for these four node types - Removes the now-unused codegen_break/next/redo/retry functions parse.y: - Updates call_with_block to handle NODE_BREAK and NODE_NEXT through NODE_VARIABLE case instead of cons-list cases - Removes the now-unused cons-list cases for these node types All control flow functionality remains identical, but the code path is simplified since these nodes exclusively use variable-sized structures. 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