|
<< Click to Display Table of Contents >> Parser and object structures |
![]() ![]()
|
The parser translates Gekko commands (or command files) into corresponding blocks of C# code (which are then compiled and executed). There are some introductory examples of this in the previous section, and in this section we will delve into this translation process in much more detail.
In this section, the following subjects are discussed:
•How the computer understands a command (file) and divides it into smaller parts (splitting, tokenizing, or parsing)? And after the command file has been split, how to run it (interpretation or compilation)?
•Variable types in Gekko (timeseries, val, date, string, list, map, matrix), and how they are represented internally in Gekko. What it means to be a dynamically typed language in contrast to a statically typed language. And what this has of consequences for how the Gekko variables can be represented in C# (and how speedy the execution can be)?
•How Gekko stores variables in RAM when they are referenced to in a command (file), and how the use of so-called cache pointers could speed up loops etc., but have to be used with care.
•How the AST tree produced by the ANTLR parser can be walked/looped while emitting snippets of C# code that build upon each other, ending up with a full sequence of C# statements equivalent to the given Gekko command. This description is done in details, since an understanding of the tree-building and C#-emission is quite fundamental if one has to augment or alter the functionality of Gekko.