I'm going through Pat Shaughnessy's Ruby Under a Microscope, and trying to supplement myself with up to date knowledge of how Ruby executes your program. Full disclosure, I have not completed the book yet, but am trying to understand as I go along. At a high level, this is what I understand.
Ruby Code -> Lexical Analysis -> Tokens
Tokens -> Parser -> AST Nodes
AST Node -> Compiler -> YARV Instructions (bytecode)
YARV Instructions -> YARV Interpreter -> ???
??? -> ??? -> Machine Language
My question is what is the output (???) of the YARV Interpreter? Where do these instructions live? As well, what then are the steps necessary to then get that into Machine Language?
If someone could help point me in the right direction or if I have missed anything I would appreciate it!
I've tried reading numerous articles online, but they don't seem to really expand on what happens after YARV Instructions are compiled. I understand that the grammatical instructions of producing YARV instructions live in the main Ruby repo, but then what comes nex?
There is no output. The interpreter doesn't generate output. It interprets (another word is "executes") the code.
More precisely: the output of the interpreter is the output of the program that is being run by the interpreter. So, if you write a program that is supposed to print "Hello, World" to the console, then the output of the interpreter running that program will be to print "Hello, World" to the console.
In RAM.
There are none. An interpreter interprets. It doesn't generate code. Something that translates code from one language to another is called a "compiler".