Jump to content
Nytro

Implementing a Virtual Machine in C

Recommended Posts

Posted

[h=1]Implementing a Virtual Machine in C[/h]

07 May 2015 [h=4]Introduction[/h] Here's the GitHub to show what we'll be making, you can also compare your code to this repository in case you have errors. GitHub Repository

I thought I would write an article about building your very own virtual machine in the C programming language. I love working on "lower level" applications such as compilers, interpreters and virtual machines. I also love talking about them too. I have another series (that is in the works) on writing an interpreted language in Go. I'm also working on my own compiled programming language Alloy.

[h=4]Prerequisites & Notices[/h] There are a few things that you need before we can continue:

  • A C compiler — I'm using clang 3.4, but you can use anything with c99/c11 support;
  • Text Editor — I would suggest a text editor over an IDE, I'll be using Emacs;
  • Basic programming language knowledge — Just the basics, like variables, flow control, functions, structures, etc.
  • Make — Just to make building our program a little quicker

[h=4]Why should I write a Virtual Machine?[/h] Here are some reasons why you should write a virtual machine:

  • You want a deeper understanding of how computers work. This article will help you understand what your computer does at a lower level, a virtual machine provides a nice simpler layer of abstraction. And there's no better way to learn than build one, right?
  • You want to learn more about how some programming languages work. For instance, various languages nowadays target virtual machines - usually written specifically for the language. Examples include the JVM, Lua's VM, Facebook's Hip-Hop VM (PHP/Hack), etc.
  • You just want to learn about virtual machines because it's fun.

Articol complet: Implementing a Virtual Machine in C

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...