Skip to content
0:00 / 0:00

#virtualmachine#interpreter#bytecode

How to Build a Virtual Machine

InfoQ

234K subscribers • 58 videos on Hallway • Conference channel

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • A classic. People kept recommending it from 2016 to 2024.
  • Presented by Terence Parr, creator of ANTLR

Advanced. Deep dive for people who know the field.

101K views12 years ago2 recommendations

Systems programmingProgramming languagesCompilers and interpretersPerformance and optimization

Terence Parr builds a virtual machine and interpreter from scratch, explaining the core mechanisms of bytecode execution.

Terence Parr gives an idea of the core mechanisms behind virtual machines by building one, in front of your eyes, from scratch. It is the same kind of commercial interpreter he made for Renault cars. More resources from NewCircle: crcl.to/z7nl5 meetup.com/SF-Computer-Language-Design-and-Implementation/

Why it's here

2 people recommend this

What people say. Recommended as an excellent, practical guide to understanding and building virtual machines and interpreters from scratch.

u/SergeantPepperin r/Compilers • Recommends

How to Build a Programming Language Virtual Machine

u/Ok_Performance3280in r/ProgrammingLanguages • Recommends

Terence Parr --- How to build a Virtual Machine

u/tekknolagiKevin3in r/ProgrammingLanguages • Mentions

On “Do you know any interesting talks about PL design/compilers/interpreters?”

Terence Parr's talk on writing a VM really blew the door open on VMs for me. He describes and implements one from scratch, live, to great success.

u/AntiRedditFain r/ProgrammingLanguages • Mentions

On “Make your own VM or compile to LLVM bytecode”

I would suggest writing your own bytecode VM first - link to this video https://github.com/parrt/simple-virtual-machine and then targeting LLVM after that: https://llvm.org/docs/tutorial/OCamlLangImpl1.html https://llvm.org/docs/LangRef.html

u/Zyklonikin r/ProgrammingLanguages • Mentions

On “How to save lox bytecode to file (from CraftingInterpreters).”

…ation - basically an infinite loop till the last opcode corresponding to "HALT" is reached. Here is a simple resource that might help you get started with some ideas - https://www.slideshare.net/parrt/how-to-build-a-virtual-machine, and the corresponding code - https://github.com/parrt/simple-virtual-machine-C There is also an accompanying video (link to this video but the video is terrible. The key point is to note the format of the opcodes (look at the file https://github.com/parrt/simple-virtual-machine-C/blob/master/src/vmtest.c) The number and format of these opcodes is entirely up to your design interests/skills. This is not the hard part. Note that these resources won't help you understand the…

u/Ok_Performance3280in r/ProgrammingLanguages • Mentions

On “Nora Sandler's book: Good only for hobbyists, and I feel, that's not an slanderous thing to say!”

Exactly. They all cover lexing and parsing, as if, it has not been covered a million times already! Some of these books (especially O. G. Kakde's) are not only made for resume-padding, but also, because they force their students to buy them, and earn some $$. Waste of paper. I think the 3rd edition of TDB, and ditto edition of 'Engineering a Compiler', already serve as sufficient textbooks. If you wanna write a compiler textbook, _have something new to say_. That's why I believe Appel's ML book, when it was not outdated as hell, served as the best introductory book to compiler construction. None of the other textbooks talk about SSA, first-class functions, functional programming, and so on.…

u/Ok_Performance3280in r/ProgrammingLanguages • Mentions

On “Nora Sandler's book: Good only for hobbyists, and I feel, that's not an slanderous thing to say!”

Exactly. They all cover lexing and parsing, as if, it has not been covered a million times already! Some of these books (especially O. G. Kakde's) are not only made for resume-padding, but also, because they force their students to buy them, and earn some $$. Waste of paper. I think the 3rd edition of TDB, and ditto edition of 'Engineering a Compiler', already serve as sufficient textbooks. If you wanna write a compiler textbook, _have something new to say_. That's why I believe Appel's ML book, when it was not outdated as hell, served as the best introductory book to compiler construction. None of the other textbooks talk about SSA, first-class functions, functional programming, and so on.…