In this episode we take the AST representation of the assembly code we get from the parser and turn it into real machine code - the bytes in memory that the virtual CPU executes as instructions. Along the way we’ll add support for labels, allowing us to write location independent and logically grouped assembly code.

This series is all about building a powerful virtual machine in JavaScript with the following features:

  • A flexible, extensible, register-based virtual machine
  • Support for signed, unsigned and floating point operations
  • A call stack
  • Interrupt capabilities
  • Ability to do memory mapping for IO
  • An assembly language with macro and module support
  • A higher level, C like language. We’ll use and expand the library from the parser combinators from scratch series
  • And finally, to be able to take the whole thing into the browser and extend it to create a sort of fantasy console - an emulator for a machine that never existed

Subscribe : https://www.youtube.com/watch?v=5PXMwvUkOKI

#js #javascript

Building a Powerful Virtual Machine in JavaScript
18.90 GEEK