The Lemur User Manual
85
Chapter 5 PARSER REFERENCE
The parser is the part of the Lemur’s brain that crunches away on the Math you throw
at it. It is used to do simple stuff like scaling an internal value or adding some Variables. But
there’s more. Due to a set of internal Operators and Functions and the possibility to create your
own, custom Functions, you can construct very complex Projects. They may include a lot of
internal calculation and interdependences between Objects helping in building the perfect,
interactive Interface.
5.1.1. Value Colouring
There is a colour code for showing the type of value in a variable or expression. The
colour changes automatically when you start typing into the respective fields:
• Black means a standard expression that is evaluates 60 times a second (every 16ms).
• Red indicated an invalid expression.
• Blue is a constant, like 10+2.
This is useful to check whether an expression is well formed. If it goes black, you
know it can be calculated – which of course still doesn’t mean it does what you want it to…
5.1.2. Vectors, Singletons and Operators
The Parser handles two kinds of variables: vectors and singletons.
a vector : {0, 2, 0.5}
a singleton : 3
If you want to access the items of a vector separately, use brackets [].
a = {1,3,4}
a[0] = 1
a[2] = 4
This also works for multiple items:
a[0,2] = {1, 4}
At the heart of the Lemur’s parser lie the Operators and Functions. They are
used to construct expressions that make the Lemur such a versatile animal.
The operators are basic mathematical critters that you should know from your Maths
classes (you do remember your Maths classes, do you?)
+, -, *, /, ^
% is the modulo operator used to calculate the remainder of a division.
10%3 = 1