2. For why?
●
Become a better developer
–
If you know internals of your language, you'll use it
more efficient
–
If you will understand more, you can help
community
●
Improve your knowledge of computer science
●
Just for fun, you know
5. What is the tokens?
10.times { |n| puts n }
●
tINTEGER
●
tIDENTIFIER
●
keyword_do, |tIDENTIFIER|
Ripper class — Ruby lexical analyzer
http://www.ruby-doc.org/stdlib-1.9.3/libdoc/ripper/rdoc/Ripper.html
6. How it parses?
●
Bison (Yacc descendant)
●
Samples of grammar rules
●
Ruby code roadmap:
–
Ruby source code
–
Tokens
–
AST Nodes
–
YARV Instructions
10. RubyVM module
●
Well-documented, you know, as before ( スタッ
クに self をプッシュする )
●
http://www.ruby-doc.org/core-2.0.0/RubyVM.html
●
Container for RubyVM::InstructionSequence
11. Benefits
●
Speed up your templates by precompiling
●
Use functional style programming
●
Trace your program if bug is hard to find
12. Bytecode Compilation
Rubinius is not needed anymore. At least,
runtime.
(little demonstration)
https://github.com/haml/haml/issues/674
https://gist.github.com/Paxa/321be47319327e5e7058
14. Where to find more?
●
Ruby under the microscope
●
Ruby sources
●
http://lmgtfy.com/?q=RubyVM
●
https://www.ruby-forum.com/forum/ruby-core
●
http://rxr.whitequark.org/mri/source/iseq.c