Falsy / Truthy

Optimization Tips

  • This time it is about optimization!

  • Don't hesitate to give me your feedback.

Guard / Early exit in swift

  • A new article on the Swift section about early exit and guard in Swift.

  • Check it out.

New Swift section

As you might have noticed, a new 'Swift' section has appeared on this site.

This section is naturally about the Swift programming language.

It will includes some articles about things I find interesting about it.


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