Creating a bytecode based programming language, part 3

Third and last post about creating a compiler and an interpreter.

We convert each
expression identified during the token reduction to an instruction (each expression kind is mapped to an instruction class).

The set of instruction objects obtained after having converted all expressions is the bytecode.


Now, how to we use it?

An instruction class is quite simple, it defines two methods: an init and a process one.

The init method has a single parameter: a token (or a complex token as it extends the token class). This token, or it's sub-tokens, is used to initialized the attributes of the instruction object.

The process method takes two parameters, firstly an execution output and then the execution context.

The execution output is mostly a StringBuffer.

The execution context is more complex. It contains access to information like the

Work of this week-end

This weekend two changes have been made on this site. First, a migration of the server hosting it, then creating ssl certificates to allow secure access (https instead of http).

To take advantage of the availability of https access, the SoHO and SDO Viewer applications are getting upgraded (new versions are currently waiting for review so should be soon downloadable).

Creating a bytecode based programming language, part 2

This is the long, or not, awaited second post about creating a compiler.

In this post we will talk about parsing a source code.

Read more…

Creating a bytecode based programming language, part 1

This is the first of a series of short posts about a subject I am currently working on as a personal side project: creating a compiler to create bytecode based programming languages.

Read more…

Implementing a VFS

While trying to implement a Virtual File System, that is to say a virtual representation of an hard drive with its folders and files, there are two main approach to consider:
- a tree based approach
- an absolute parent path approach

Read more…