AREMOS translator details

<< Click to Display Table of Contents >>

Navigation:  Appendix >

AREMOS translator details

Previous pageReturn to chapter overviewNext page

The AREMOS translator (cf. the TRANSLATE statement) tries to translate AREMOS command files into corresponding Gekko program files.

 

This translator translates from AREMOS into Gekko 3.0 syntax (which is suitable for 3.1.x, 3.2, and 3.3.x, too).

 

First of all, Gekko recognizes AREMOS abbreviations, and will for instance recognize DE, DEL, DELE, DELET, and DELETE as all being the same DELETE command. Gekko has few abbreviations, because it may render program files hard to decipher.

 

The following commands are translated:

 

ACCEPT has a note that the syntax is a bit different.

ASSIGN x value #y ==> %x = %y.

ASSIGN x integer #y ==> %x = %y.  If the integer is date-like, a Gekko DATE is used instead, for instance "ASSIGN per1 integer 1966;" ==> "DATE per1 = 1966;".

ASSIGN x string #y ==> %x = %y.

ASSIGN x literal #y ==> %x = %y. If the literal is date-like, a Gekko DATE is used instead, for instance "ASSIGN per1 literal '1966a1;" ==> "DATE per1 = 1966A1;".

CLOSEALL ==> RESTART. CLOSEALL is a procedure. A note is given that in some cases, CLOSE *; CLEAR; is a better replacement.

CONVERT ==> COLLAPSE. CONVERT seems to be a procedure that does the same as COLLAPSE.

COPY ... AS ... ==> COPY ... TO ...  . Regarding COPY, AREMOS allows for instance "COPY d:var1 as e:;" with an 'e:' to indicate the destination databank. Gekko demands a '*' after the colon, so such a statement is translated into "COPY d:var1 to e:*;".

EXCELEXPORT ==> SHEET. A note is given on syntax differences.

EXCELIMPORT ==> SHEET<import>. A note is given on syntax differences.

FOR: Gekko tries to guess the type of the loop variable, if it is FOR y = x1 TO x2 BY x3. Here, if x1 and x2 look like dates, Gekko will use FOR data y = ...., else if they look like normal values, Gekko will use FOR val y = ... . Assign-variables starting with 'per' (for instance #per0) are always deemed to have date-flavor!

GRAPH ==> PLOT.

IF: AREMOS apparantly accepts IF-statements without parentheses, for instance "IF #v > 100; SERIES x = 200; END;". Gekko puts parentheses like this: "IF (#v > 100); SERIES x = 200; END;", to conform with Gekko syntax.

INDEX: Syntax changed a bit, and options showbank=no and showfreq=no are set, to correspond with AREMOS.

OBEY ==> RUN.

OPEN<protect> ==> just OPEN (Gekko databanks are protected as default).

OPEN<primary> is changed to OPEN<edit>

PRINT ==> PRT.

RESTORE ==> gets a not about using RUN, where .opt is added to filename if this extension is not there already.

SET ==> OPTION.

SET PERIOD ==> TIME.

SET REPORT DECIMALS ... ==> Note that the syntax is: OPTION print fields ndec ... .

SET REPORT COLUMNS ... ==> Note that the syntax is: OPTION print fields nwidth = ... .

SET SAVEFILE ... ==> gets a note on using PIPE or PIPE con.

SERIES with inline if-then-else are decorated with a comment about using the iif() function. Note in general that "SERIES y = 100 rep *;" is not necessary in Gekko ("SERIES y = 100;" will do). Gekko will ignore such stray 'rep *', but they may clutter the program files. SERIES labels like "SERIES 'label' y = x;" are transformed into "SERIES <label = 'label'> y = x;".

SOLVE ==> SIM.

SPOOL ==> PIPE.

STOP ==> EXIT.

UNSPOOL ==> PIPE con.

VIS ==> PLOT.

 

The translator keeps track of assign-vars, lists and matrices. Assign-vars get '%'-identifier, lists keep their '#'-identifier, and matrices get '#'-identifier (apart from this, please note that the Gekko matrix syntax is somewhat different from AREMOS matrix syntax -- the translator does not handle these differences).

 

In addition:

 

'!' is translated into '//'

Double quotes (") are translated into single quotes (')

List operators + and * are translated into || and &&.

Double '#' like '##x' have a note about their proper translation ('%{%x}' or '#{%x}')

'repeat' is changed to 'rep'

Tries to eliminate spurious '|', for instance "PRINT a#i| + b#i|;" ==> "PRINT a%i + b%i;". AREMOS accepts '|' almost anywhere, so AREMOS programs get easily infected with too many of these. The elimination is heuristic.

Numbers: Gekko 2.0 does not support '123.' to be the same as '123' or '123.0'. The reason is that Gekko uses '..' for ranges (for instance #m[2..4]), where a number like '123.' would interfere badly. So Gekko translates for instance '123.' into '123.0'.

Functions: Gekko does not support for instance "VAL v = log (10);", note the blank between the log function and the parenthesis. So the translator removes such blanks for the functions log(), exp(), pow(), abs(), pch(), dlog().

Logical operators: In AREMOS they may be separated by blanks, for instance '< =' instead of '<=' or '< >' instead of '<>'. Gekko removes such blanks.

For lists, #a + #b ==> #a || #b, and #a * #b ==> #a && #b.

Any '.cmd' is changed into '.gcm', for instance "RUN f.cmd;" ==>  "RUN f.gcm;".

Strings like 'the value is #x' are replaced with 'the value is {%x}'.

Frequencies .a, .q and .m use '!' instead, for instance x.q ==> x!q.

Variables on the left-handside get '%' or '#' if they are not series, for instance LIST m = a, b; -->  LIST #m = a, b;

sum(0, a, b) is changed into sum(a, b). Gekko does not have this problem.

An option field like SERIES <2020 2030> y = 100; is moved to the right of y, so it becomes y <2020 2030> = 100;.

The translator tries to set {}-curlies where they are needed (for instance around assign literals).

Dynamic series like series series x = x[-1] + 2; are identified and decorated with <dyn> tag.