Smalruby: Visualizing Ruby with Bidirectional Transpiration
Smalruby 3 (https://smalruby.app) is a visual programming environment that seamlessly bridges the gap between Scratch blocks and Ruby code. While Scratch is the de facto standard for K-12 education, transitioning to text-based languages remains a high barrier. Smalruby 3 solves this by providing real-time, bidirectional conversion between blocks and Ruby.
In this talk, I will explore the technical challenges and implementation details of Smalruby 3. How do we map Scratch's event-driven, actor model to Ruby's object-oriented syntax? How is the AST manipulated to ensure that a move(10) block becomes a method call, and conversely, how arbitrary Ruby code is parsed back into visual blocks?
I will demonstrate how puts "Hello" is visualized not as console output but as a speech bubble from a sprite, and how class and def definitions intuitively map to actor properties and behaviors. This session reveals how we can "visualize" Ruby's semantics to foster the next generation of Rubyists.
-
Kouji TakaoA software engineer at NaCl Ltd., developing enterprise systems with Ruby for over 20 years. I also dedicate my weekends to teaching K-12 students. My project, Smalruby, is widely used in junior high schools and featured in textbooks, bridging the gap between visual blocks and Ruby code.