|
<< Click to Display Table of Contents >> Gekko 2.0 translator details |
![]() ![]()
|
The Gekko 2.0 to 3.0 translator (cf. the TRANSLATE statement) tries to translate Gekko 2.0/2.2/2.4/2.5.x program files into corresponding Gekko 3.x program files.
The following statements are translated:
•COMPARE has a note about changed syntax
•COLLAPSE has . changed into !
•DOWNLOAD has a note about quotes
•FOR has type and type symbol added.
•INDEX a*b m --> INDEX a*b TO #m. Added <showbank=no showfreq=no> option.
•IMPORT/EXPORT have <all> added to the option field, if the option field does not indicate two dates. Also, IMPORT<ser> --> IMPORT<flat>.
•(series pp, series qq) = laspchain(...) --> pp = laspchain(...).p; qq = laspchain(...).q;
•LIST listfile m = ... ; --> #(listfile m) = ... ;
•NAME changed to STRING.
•hpfilter() and unpack() have CREATE removed.
•LIST: &+ --> ||, &* --> &&, &- --> -
•LIST<direct> is removed.
•LIST: prefix --> .prefix(), suffix --> .suffix(), trim --> .unique(), sort --> sort(), strip --> replaceinside(). Use of strip in list has a new syntax explanation
•MATRIX: || --> ;
•VAL, STRING, DATE have % added on left-hand side and statement removed.
•LIST and MATRIX have # added on left-hand side and statement removed.
•SERIES has statement removed.
•SERIES: Operator ^ --> ^=, % --> %=, + --> +=, * --> *=, # --> #=.
•SERIES #m = ... ; --> {#m} = ... ;
•SERIES y = 100 rep *; --> y = 100;. Superfluous rep * are often inherited from AREMOS.
•SERIES x = x[-1] + 1; --> x <dyn> = x[-1] + 1;
•SHOW renamed to PRT.
•Wildcards like [a*b?c] are changed into ['a*b?c'] or {'a*b?c'} depending on context. Ranges like [a1..b5] are changed into ['a1'..'b5'] or {'a1'..'b5'}.
•Variables like %(...) or #(...) have a note that it is better to use {}-curlies. For instance, %(a%b) can be written as %a{%b}.
In addition:
•In general, the translator tries to add {}-curlies around %x or #x variables, when these curlies are not already present but required in Gekko 3.0/3.x To do this, the translator may look at the definitions of %x (whether string, name, date or val) or #x (whether list or matrix). If the variable is explicitly of date, val or matrix type, no {}-curlies are added. In other cases, there may be an element of guessing, depending upon the particular statement or function used, so in some cases, {}-curlies may be added in places where they should not. To determine the type of %x or #x, only the current program file is looked at (this may pose a problem if the variable is defined somewhere else). All {i} are replaced with {%i}. The translator never removes existing {}-curlies.
•Index [0] --> length(), for instance #m[0] --> #m.length().
•Paths like data\%x\%y are transformed into data\{%x}\{%y}, for instance for READ etc.
•A string like 'ab %s cd' is transformed into 'ab {%s} cd' (string interpolation). Also translates ~ and | inside strings.
•avg() and sum() will convert for instance sum(#m) into sum({#m}). The summing sum(#i, x[#i]) will not be translated correctly, however. It will become sum({#i}, x[#i]), where it should not be altered.
•avgt() --> note about <> syntax for local time
•difference() --> except()
•endswith() --> note about case-insensitive in 3.0
•fromseries() --> note about the fact that the first argument must be series, not string.
•hpfilter() --> note about <> syntax for local time
•pack() --> note about <> syntax for local time
•piece() --> substring()
•replace() --> note about case-insensitive in 3.0
•search() --> index()
•startswith() --> note about case-insensitive in 3.0
•strip() --> replace()
•sumt() --> note about <> syntax for local time
•trim() --> strip()
•unpack() --> note about <> syntax for local time
•An option field like series <2020 2030> y = 100; becomes y <2020 2030> = 100;.
•Differences in globals options (OPTION statement) are handled.
•You may optionally keep types when translating assignments, so that VAL x = 100; becomes VAL %x = 100; instead of just %x = 100;. This is controlled with the <keeptypes> option when calling the translator. Applies to SERIES, VAL, DATE, STRING, LIST and MATRIX.
•All VAL, DATE, STRING, LIST and MATRIX definitions have global: added. For instance, VAL x = 100; becomes global:%x = 100; or VAL global:%x = 100;. And LIST m = a, b; becomes global:#m = a, b; or LIST global:#m = a, b;.
Since the databank logic and simulation parts are not changed between Gekko 2.x.x and Gekko 3.x.x, translation is generally not too difficult regarding the more basic kinds of statements. If using more complicated stuff from Gekko 2.x.x, the translation may be wrong. In that case, please consult the Gekko 3.x.x documentation to see how the statement looks in the new syntax.
For non-series, the translator will put a global: on the variable. These can often be omitted, but in Gekko 2.x, non-series did not live in databanks, hence the use of global: in the translation.