Yazoo ---> Online Help Docs

Yazoo bytecode

Life as a Yazoo script proceeds through three phases. A newborn script enters the world as a string of text stored in one of the user's variables. Metamorphosis to the second state, called compilation, involves the compiler taking that script, chewing it up and reforming the bits into a new, binary string -- bytecode, in computer jargon. In some cases the programmer might want to tweak this bytecode a bit, but usually we are content to just let the butterfly be. In both stages 1 and 2 the script lives as an ordinary string in an ordinary variable of the user.

To attain the third and final stage of its existence, a compiled script transmigrates from a lowly string variable to a perch on the ivory bench of Yazoo's internal code registry. In Yazoo-speak, this process is called a transformation. A transformed script is no longer contained in a variable, so the user cannot modify it. Instead it has become the soul of some other variable, now more appropriately called a function because running it causes the script to do its thing within that function variable. The gatekeeper of the code registry, Yazoo's built-in transform() function, first scrutinizes each aspiring script for problems that could crash the interpreter, and is entrusted with a special set of error codes that it can throw when such a defect is encountered.

In this chapter we will discuss both the syntax of the bytecode string and what the transformed code does when it runs. Our purposes are twofold. One benefit is that the language of compiled bytecode is an arcane bit of lore that comes handy in certain (usually obscure) situations. The second justification is for a broader audience: Yazoo only executes bytecode, not scripts directly, so knowing how one's script translates into bytecode gives the ultimate insight into why it works in the way that it does. This chapter will show that scripting syntax is heavily constrained, and that the seeming plethora of entities in Yazoo is played by relatively few actors in the bytecode world. To begin with, we shall show that all objects in Yazoo are one of two things: primitive variables or functions.


Prev: Inheritance   Next: Functions, revisited


Last update: July 28, 2013

Get Yazoo scripting language at SourceForge.net. Fast, secure and Free Open Source software downloads