Multitech MTPSR1-202ST Betriebsanweisung Seite 61

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 104
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 60
Appendixes
61
MTPSR1-202ST
Script Language Grammar
<program> =<declarations> <proc_declarations>
<declarations> ={<var_type> <identifier> {, <identifier> } ; }
<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 <identifier>=<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:
proc a;
integer t;
/*Some more code here. */
t=b(x,y);
/*Some more code here. */
return(t);
endproc
proc b;
return(a(u,v);
endproc
Argument to procedures can be passed by value or address. To pass an argument by address, prefix
the argument name in the formal parameter list by the keyword VAR; otherwise the argument is
passed by value. Only variables can be passed by address. Expressions like A+B, where A and B
are integer variables can be passed by value but cannot be passed by address.
Seitenansicht 60
1 2 ... 56 57 58 59 60 61 62 63 64 65 66 ... 103 104

Kommentare zu diesen Handbüchern

Keine Kommentare