Keywords: gildas-prog

Next: The command dispatching and Up: Initializing SIC: Languages and Previous: Packages Contents Index

## Language Definition

A language contains an ensemble of commands. Each language must be initialized by means of an appropriate call to the routine SIC_BEGIN. This routine has the following calling list:

              SIC_BEGIN(LANG,HELP,MCOM,VOCAB,VERSION,Dispatch,Error)

`LANG` is a Character constant which gives the name of the language. `LANG` need not be distinct from the command names, and it must not include the character which will appear in the internal `HELP` of SIC. `MCOM` is the number of commands and options appearing in the language vocabulary `VOCAB.` All commands in a SIC language are `CHARACTER` constants in which the first character is a reserved code. Lower case characters are not allowed, but the special character `"_"` may appear. All other special characters have (or may have in the future) some specific meaning in SICThe following is the `DATA` initialization statement of SIC itself given as an example of language.

      integer :: sic_commands
      parameter (sic_commands=76)
      character(len=12) :: sic_vocab(sic_commands)
      data sic_vocab/                   &
        ' HELP',                        &  ! Must be the first one...
        ' @',                           &  ! Others by alphabetic order
        ' ACCEPT',  '/ARRAY','/BINARY','/COLUMN','/FORMAT','/LINE',        &
        ' BEGIN',                       &
        ' BREAK',                       &
        ' COMPUTE', '/BLANKING',        &
        ' CONTINUE',                    &
        ' DEFINE',  '/GLOBAL','/LIKE',  &
        ' DELETE',  '/SYMBOL','/VARIABLE','/FUNCTION',                     &
        ' EDIT',                        &
        ' ELSE',                        &
        ' EXAMINE', '/GLOBAL','/FUNCTION','/HEADER','/ADRESS','/ALIAS',    &
        '#EXIT',                        &
        ' END',                         &
        ' FOR',     '/WHILE',           &
        ' IF',                          &
        ' IMPORT',  '/DEBUG',           &
        ' LET',     '/NEW','/PROMPT','/WHERE','/RANGE','/CHOICE','/FILE',  &
                    '/INDEX','/SEXAGESIMAL','/LOWER','/UPPER','/FORMAT',   &
                    '/FORMULA','/REPLACE','/STATUS',                       &
        ' MESSAGE',                     &
        ' MFIT',    '/START','/STEP','/WEIGHTS','/EPSILON','/METHOD',      &
                    '/ITERATIONS','/QUIET','/BOUNDS',                      &
        ' NEXT',                        &
        ' ON',                          &
        ' PAUSE',                       &
        ' PYTHON',  '/END',             &
        '#QUIT',                        &
        '#RECALL',                      &
        ' RETURN',                      &
        ' SAY',     '/FORMAT',          &
        ' SIC',                         &
        ' SORT',                        &
        ' SYMBOL',  '/INQUIRE',         &
        ' SYSTEM',                      &
        ' TYPE'/

The first character code is interpreted as follow

  `<space>` Usual command
  `/` Option of the preceding command
  `#` Command forbidden in the stack and in procedures. Commands of this type are still written in the Log_File.
  `$` Special command which must not be inserted automatically in the stack. Commands of this type are written in the Log_File
  `*` Purely informative command, which is only useful in an interactive session. Commands of this type are not written in the Log_File and not inserted in the Stack.

The `*` code can also be used for complex commands using alphanumeric keywords that you wish to expand yourself before saving them in the Log_File and the Stack, or for commands that may require to output several records (See `SIC_INSERT,` `SIC_LOG` and `SIC_LIRE).` The GREG command `DRAW` is an example of this.

The programmer should be careful about deciding what attribute to give to any command. All the options referring to a command must immediately follow it. At initialization time, SIC recognizes the options and set up a table of pointers connecting the options to their respective commands. A failure to respect the adequate order results in a very strange vocabulary.

`VERSION` is a character string which must contain the version number, and may contain the date of last modification, the name of the programmer,... The following example is recommended for optimum presentation (respect the alignment of the date for different languages):

              VERSION='1.0   21-APR-1984   Programmer Name'

`Dispatch` is a subroutine to handle the dispatching of actions for all commands in the language.

`ErrorRoutine` is a subroutine to perform the error recovery action in case the execution of a command of this language returns an error. It may do nothing.

Next: The command dispatching and Up: Initializing SIC: Languages and Previous: Packages Contents Index