Multi-Tech Systems MTASR1-100 Network Router User Manual


 
MTASR1-100 Owner’s Manual
200
Appendix B - Script Language
The script file can be used to antomate certain operation. The script file is a text file containing a sequence of
commands. The structure of a script file in succinctly expressed by the following grammar.
Script Language Grammar
<program> =<declarations> <proc_declarations>
<declarations> ={<var_type> <identifier> {,<indentifier> } ; }
<var_type> =INTEGER I STRING
<statement_list> ={<statement>}
<statement> =<elementary_statement> I <if_statement> I
<for_statement> I <while_statement> I
<switch_statement>
<if_statement> =IF <expression> THEN
<statement_list> {
ELSE
<statement_list> }
ENDIF
<for_statement> =FOR <indentifier>=<expression> TO IDOWNTO
<expression} STEP <expression> / DO
<statement_list>
ENDFOR
<while_statement> =WHILE <expression> DO
<statement_list>
ENDWHILE
<switch_statement> =SWITCH <expression> {
CASE <integer_const> <statement_list> I
CASE <string_const> <statement_list> I
DEFAULT <statement_list> }
ENDSWITCH
<elementary_statement> =<identifier> = <expression> ; I
<identifier> / (<expression> {,<expression> } ) /; I
GOTO <identifier> ; I <identifier> : I ;
<expression> =<expression> OPERATOR <expression> I
{<expression> } I /<expression>I-<expression> I
<identifier> / (<expression> {, <expression> } ) /
OPERATOR = < I <= I > I >= I == I != I && I II I + I - I * I / I !
<proc_declaration> =PROC <identifier>/(<parameter_list>)}
{ :<vartype> };
FORWARD ;
<proc_declaration> =PROC <identifier>/(<parameter_list>)}
/ : <vartype> / ;
<declarations> <statement_list>
ENDPROC
<parameter_list> =<argument_list> { ; <argument_list>}
<argument_list> ={VAR} <var_type> <identifier> {<identifier>}
Execution starts at the PROC main. PROC main cannot have any arguments. All the variables have to be
declared before use. All procedures must be declared before calling. Recursion is allowed in procedures.
To define mutually recursive procedures, use the FORWARD directive to indicate that the procedure body is
defined later in the source file. Procedures defined with the FORWARD directive should have all the
parameters and return value (if any) specified, the actual definition of the procedure body should not contain
the formal parameter list or the return value. An example of forward defined procedures is given below:
proc a(integer x,y) : integer,forward:
proc b(integer u,v) : integer,forward: