Tutorial 0 (hello GeLB!)
Let's not waste much time, and start showing you some hands-on examples!
Prerequisite for this tutorial
To get the most out of this tutorial, please make sure you followed our
Getting started guide, which shows you how to install the
GeLB compiler (gelbc
) and plugins for your editor / IDE.
All good? OK, let's go!
It seems that most self-respecting programming languages need a "hello world"
example, which demonstrates the basic syntax.
Unfortunately, GeLB
does not (currently) have nice printing capabilities,
so it cannot even say hello.
That is not to say that GeLB
is not self-respecting!
Everyone is different, and GeLB
wants to operate on numbers -- instead of
a greeting, we will show you how to increment a vector.
Granted, this is not much more exciting than printing a message, but it will
give us the opportunity to go over the most important elements that you need in
all GeLB
programs.
Rest assured -- once you are done with this tutorial, in the following ones
we will show you how to create much more interesting simulations using
GeLB
.
#
Some preparationLet's start by creating a new directory for our simulation:
Separate directory (folder) for each simulation
When executed, most GeLB
programs will generate files containing the output
of your simulation.
To avoid confusion, create a separate directory for each new simulation.
Open your editor/IDE, and create a new file in that directory. We will call it
tutorial_0.gelb
.
.gelb
file#
General structure of a Each GeLB
program should start with two assignment-like lines, which specify
the name and the description of the simulation:
Afterwards, we have a series of standard blocks, which correspond to the concepts discussed in the previous section, as follows:
As discussed in the main concepts, there are a few elements (blocks) which you will encounter over and over again...
TODO
#
TODOTODO
#
TODOTODO
#
TODOTODO
#
TODOTODO
#
TODOTODO
#
TODOTODO