CONTENTS   NextPrevious  



Shell Language Description

The Backus-Naur MetaLanguage

Formally, the language’s grammar is defined as G = { C , N , P , S }, where:

C is the alphabet or a set of terminal signs
N is a set of special grammar units called nonterminal signs
P is a set of rules, which defines whether a string belongs to the language
S is a special nonterminal sign called start sign

A special system of signs is required to write the rules from the set P . The Backus-Naur form (or Backus’ Normal Form – BNF) is such a system. In this system, the nonterminal signs are enclosed in angle brackets – < and >. The rules of the set P must be written as:  < Z > ::  = A | B | …| W , where: Z is a nonterminal sign; A , B ,…, W are strings that are generated from concatenated strings from S and N . The vertical lines ( | ) give alternatives in defining the nonterminal sign Z, which stays on the left of the sign for defining “ :: =“.
For example: <digit> :: = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9                       

Internal Marks

Input

Grammar (Syntax and Semantics)

                               end_for <EOL_symbol>

Expressions

Each expression must be enclosed in brackets. When an expression is met it is computed. The value of the expression is a string.  There are two types of expressions:

Operations

There are three types of operations:

Logical Operations

The logical operations are described according to their priority:

> ECHO (1 = 1)
TRUE
> ECHO (5 != 3)
TRUE
> ECHO (1 = A)
FALSE
> ECHO (V >= 2)
TRUE
> ECHO (A > B)
FALSE
> ECHO (a > B)
TRUE

Arithmetic Operations

The arithmetic operations are described according to their priority:

Note: If one or both of the arguments cannot be represented as numbers, the result from the operation is ERROR.

Examples:
ECHO (5 / 2)
>2
ECHO (5 % 2)
>1

Operations with Strings

There is only one operation:

Constructions

Note: * means that all input parameters ($1, $2 ... $n) are traversed.

Note: The block is executed while the expression value is TRUE .

Previous  Next