Category Archives: Virtual machine

The OrchIDS virtual machine, bytecode interpreter and compiler

Extending the language

Imagine you want to add a new construction to the Orchids language.  A simple way is to just add a new primitive.  However, in some cases this is not enough. Imagine Orchids did not have multiplication.  We might add it as a primitive, and name it mult for example. However you would then be forced to write, say, $x = mult($y, $z) to multiply $y with $z in Orchids signatures instead of the cosier $x = $y*$z. Continue reading

Writing simple primitives

The language of Orchids includes several primitives, but you may want to add new ones.

The main primitives of Orchids are coded in lang.c. Some others are provided by modules.  Let us look at a simple example, that of the function int_from_str, which converts a string such as "12" to the corresponding integer (12 here). Continue reading