Contents Previous Next Subchapters

Formal Syntax

Description
The following chart gives the formal syntax for the O-Matrix language in Backus-Naur form. Constructions are in upper case and are defined by a rule below except for those listed in the following table:
Construction Definition
ID Glossary entry for identifier
INCLUDE_DIRECTIVE Syntax for include directive
INT_CONSTANT Integers
REAL_CONSTANT real numbers
DOUBLE_CONSTANT double-precision numbers
COMPLEX_CONSTANT complex numbers
STRING strings
NEW_LINE the character with ascii code equal to 10
NOTHING an empty input sequence; i.e., no input characters
Words and symbols that are not upper case letters appear in O-Matrix source code exactly as printed below.
START STATEMENT
DIRECTIVE
ASSIGN VAR = EXP
[ ID_LIST ] = EXP
ASSIGN_STATEMENT ASSIGN EOS
VAR ( EXP_LIST_COLON ) = EXP EOS
VAR .row ( EXP_LIST ) = EXP EOS
VAR .col ( EXP_LIST ) = EXP EOS
VAR .blk ( EXP_LIST ) = EXP EOS
BASE_STATEMENT base ID ( EXP_LIST ) EOS
BINARY EXP * EXP
EXP / EXP
EXP \ EXP
EXP + EXP
EXP - EXP
EXP ^ EXP
EXP % EXP
EXP == EXP
EXP <> EXP
EXP > EXP
EXP < EXP
EXP >= EXP
EXP <= EXP
EXP and EXP
EXP or EXP
BLOCK begin STATEMENT_LIST end
BREAK_STATEMENT break EOS
CLEAR_DIRECTIVE clear ID_LIST EOS
COMBINE_COLUMNS [ EXP_LIST ]
COMBINE_ROWS { EXP_LIST }
COMMAND_LIST NOTHING
STRING
COMMAND_LIST , STRING
COMMAND_EXP ID COMMAND_LIST EOS
CONSTANT_DIRECTIVE const ID = EXP EOS
CONSTANT true
false
INT_CONSTANT
REAL_CONSTANT
DOUBLE_CONSTANT
COMPLEX_CONSTANT
STRING
DIMENSION_STATEMENT dim ID ( EXP_LIST ) EOS
DIRECTIVE FUNCTION_DIRECTIVE
LABEL_DIRECTIVE
CLEAR_DIRECTIVE
CONSTANT_DIRECTIVE
LOAD_DIRERCTIVE
DLL_DIRECTIVE
GLOBAL_DIRECTIVE
INCLUDE_DIRECTIVE
SAVE_DIRECTIVE
MLMODE_DIRECTIVE
OMATRIX_DIRECTIVE
EOS
DLL_DIRECTIVE dll , ID_LIST EOS
ELSE_CLAUSE NOTHING
else STATEMENT
EOS NEW_LINE
;
EXIT_STATEMENT exit EOS
EXP PRIMARY
BINARY
COMMAND_EXP
UNARY
COMBINE_ROWS
COMBINE_COLUMNS
SEQUENCE
EXP_LIST NOTHING EXP
EXP_LIST , EXP
EXP_LIST_COLON EXP_OR_COLON
EXP_LIST_COLON , EXP_OR_COLON
EXP_OR_COLON EXP
:
EXP_STATEMENT EXP EOS
FOR_STATEMENT for ID = EXP to EXP BLOCK
FORMAT_STATEMENT format int EXP EOS
format real EXP EOS
format double EXP EOS
format complex EXP EOS
FUNCTION function
local function
FUNCTION_ASSIGNMENT FUNCTION ID = ID ( ID_LIST ) EOS
FUNCTION_DIRECTIVE FUNCTION ID ( PARAMETER_LIST ) BLOCK
FUNCTION [ ID_LIST ] = ID ( PARAMETER_LIST ) BLOCK
GLOBAL_DIRECTIVE global ID_LIST EOS
GOTO_STATEMENT goto ID EOS
HALT_STATEMENT halt EOS
THEN_CLAUSE STATEMENT
ID_LIST NOTHING
ID
ID_LIST , ID
IF_STATEMENT if EXP then THEN_CLAUSE ELSE_CLAUSE
KEYWORD_FUNCTION KEYWORD_FUNCTION_NAME ( EXP_LIST )
KEYWORD_FUNCTION_NAME rowbase
colbase
rowdim
coldim
logical
char
execfile
int
real
double
type
format
seq
feval
LABEL_DIRECTIVE label ID
LOAD_DIRECTIVE load EOS
LOCAL_STATEMENT local ID = EXP EOS
MLMODE_DIRECTIVE mlmode EOS
OMATRIX_DIRECTIVE omatrix EOS
PARAMETER ID
function ID
PARAMETER_LIST NOTHING
PARAMETER
PARAMETER_LIST , PARAMETER
PRIMARY ( EXP )
CONSTANT
KEYWORD_FUNCTION
PRIMARY_LOAD
PRIMARY_LOAD function ID
VAR
VAR ( EXP_LIST_COLON )
VAR .row ( EXP_LIST )
VAR .col ( EXP_LIST )
VAR .blk ( EXP_LIST )
PRINT_STATEMENT print EXP_LIST EOS
RETURN_STATEMENT return EXP EOS
return EOS
SAVE_DIRECTIVE save EOS
SEQUENCE EXP : : EXP
EXP : EXP : EXP
STATEMENT ASSIGN_STATEMENT
BASE_STATEMENT
BREAK_STATEMENT
BLOCK
DIMENSION_STATEMENT
EXIT_STATEMENT
EXP_STATEMENT
FOR_STATEMENT
FORMAT_STATEMENT
FUNCTION_ASSIGNMENT
GOTO_STATEMENT
HALT_STATEMENT
IF_STATEMENT
LOCAL_STATEMENT
PRINT_STATEMENT
RETURN_STATEMENT
STOP_STATEMENT
WHILE_STATEMENT
STATEMENT_LIST STATEMENT
DIRECTIVE
STATEMENT_LIST STATEMENT
STATEMENT_LIST DIRECTIVE
STOP_STATEMENT stop EOS
stop EXP_LIST EOS
UNARY + EXP
- EXP
| EXP |
not EXP
EXP '
VAR ID
arg ( EXP )
WHILE_STATEMENT while EXP BLOCK