Instruction List (IL)

This language is more appropriate when your algorithm refers to the Boolean algebra.

A program written in IL language is a list of instructions.

  • Each instruction is written on one line of text.
  • An instruction can have one or more operands.
  • Operands are variables or constant expressions.
  • Each instruction begins with a label, followed by a colon (:).
  • Labels are used as destination for jump instructions.

KAS-IDE allows you to mix ST and IL languages in textual program.

  • ST Language is the default language.
  • When you enter IL Language instructions, the program must be entered between BEGIN_IL and END_IL keywords.

Example

BEGIN_IL
FFLD   var1
ST     var2
END_IL

Comments

Comment text can be entered at the end of a line containing an instruction.

  • Comment texts have no meaning for the execution of the program.
  • Comment text must begin with (* and end with *).
  • Comments can be entered on empty lines (with no instruction) and on several lines (i.e., a comment text can include line breaks).
  • Comment texts cannot be nested.
(* My comment *)
LD a
ST b (* Store value in d *)

Data Flow

An IL Language complete statement is made of instructions for:

  • first: evaluating an expression (called current result).
  • then: use the current result for performing actions.

Evaluation of Expressions

The order of instructions in the program is the one used for evaluating expressions, unless parentheses are inserted.

This list is the available instructions for evaluation of expressions:

Instruction

Operand

Meaning

Addition +

Numerical

Performs an addition of all inputs.

Adds the operand and the current result.

AND  ANDN  &

Boolean

Performs a logical AND of all inputs.

AND between the operand and the current result.

Divide /

Numerical

Performs a division of all inputs.

Divide the current result by the operand.

EQ =

Numerical

Test if the first input is equal to the second input.

Compares the current result with the operand.

Assignment :=

Any type

Loads the operand in the current result.

Function Call

Functional Arguments

Calls a function.

GE >=

Numerical

Tests if the first input is greater than or equal to the second input.

Compares the current result with the operand.

GT >

Numerical

Test if the first input is greater than the second input.

Compares the current result with the operand.

LE <=

Numerical

Test if the first input is less than or equal to the second input.

Compares the current result with the operand.

LT <

Numerical

Test if the first input is less than the second input.

Compares the current result with the operand.

Multiply

Numerical

Performs a multiplication of all inputs.

Multiply the operand and the current result.

NE <>

Numerical

Test if the first input is not equal to the second input.

Compares the current result with the operand.

OR / ORN

Boolean

Performs a logical OR of all inputs.

OR between the operand and the current result.

Parenthesis (  )

 

Changes the execution order.

Subtraction -

Numerical

Performs a subtraction of all inputs.

Subtract the operand from the current result.

XOR / XORN

Boolean

XOR between the operand and the current result.


  • Instructions suffixed by N use the Boolean negation of the operand.

Actions

These instructions perform actions according to the value of current result.

Some of these instructions do not need a current result to be evaluated.

Instruction

Operand

Meaning

CAL

f. block

Calls a function block (no current result needed).

CALC

f. block

Calls a function block if the current result is TRUE.

CALNC / CALCN

f. block

Calls a function block if the current result is FALSE.

JMP

label

Jump to a label - no current result needed.

JMPC

label

Jump to a label if the current result is TRUE.

JMPNC / JMPCN

label

Jump to a label if the current result is FALSE.

R

Boolean

Sets the operand to FALSE if the current result is TRUE.

RET

 

Jump to the end of the current program - no current result needed.

RETC / RETNC / RETCN

 

Jump to the end of the current program if the current result is TRUE / FALSE.

S

Boolean

Sets the operand to TRUE if the current result is TRUE.

ST  / STN

Any type

Stores the current result in the operand.


  • Instructions suffixed by N use the Boolean negation of the operand.


  • An IL Language program cannot be called if there is no entry variable or if it's type is complex (e.g., array).

Related Topics

also see "Structured Text (ST) / Instruction List (IL) Editor" on page 1