Saturday, June 26, 2010

Cosmos - Compiler and Virtual Machine

I have been thinking about Cosmos architectural design, and I realized that separating compiler and virtual machine in distinguishable shared/dynamic libraries is a great idea. Interpreter virtually encapsulates compiler and virtual machine. But in essence, it is just compiler and virtual machine. Compiler takes source code file/buffer and produces native code or bytecode. Virtual machine loads and runs native code or bytecode, and receives input and produces output.

Couple other things one should have in mind. Such a design means that other compiler and virtual machine implementations can be easily switched and tested without messy source code hackings.

No comments:

Post a Comment