Crash course in transpiling Ruby
summary
A practical walkthrough of a working transpiler called ruby-next that parses Ruby with parser/unparser, applies per-feature AST rewriters (pattern-matching rewriter is ~1000-line rewriter), and emits compatible Ruby or rewrites source in-place to preserve line mappings. Runtime use patches require to transpile on load, and real-world transpiled pattern-matching code can be roughly 1.5× faster than the original; gems can ship pre-transpiled code and apps can transpile at boot.
AI-written summary · about
chapters (7)
- 0:00Introduction to transpiling Ruby
- 3:35What is a transpiler
- 8:07Transpiling pipeline explained
- 14:57Preserving source code layout
- 17:25Performance of transpiled code
- 20:19Runtime transpiling with Ruby Next
- 24:14Conclusion and Q&A
related talks
39mRuby Next: make old Ruby quack like a new one
32mPre-evaluation in Ruby
45mUsing Ruby to Generate Faster Ruby Code through Partial Evaluation
33mRuby the Hard Way: Writing Bytecode to Optimize Plain Ruby
29mRuby Internals: A Guide For Rails Developers
29mSmalruby: Visualizing Ruby with Bidirectional Transpiration
38mRubyX: Compiling Ruby and it's effect on the community
36mCompiling Ruby
