Rules for the syntax

A KCM Core script is basically a list of commands preceded by the input, such as a parameter, variables, and constants, needed by these commands. A script is run from top to bottom: what comes first is resolved first.

To control the flow through a script, you can use conditional statements and iterations. These statements allow you to create a script that can do different things based on the result of an expression. The following is a list of the syntax rules that you should use to make a KCM Core script valid and readable:

  • White space is ignored, but you can use it to make scripts readable.
  • Every statement in a script must be closed with a semicolon.
  • Parentheses: any expression can be enclosed in parentheses to affect the order of calculation.
  • Parameters, constants, and variables are typed and must be declared. The types are Text, Number, or Boolean.
  • Text: a string value must always be enclosed in quotes. File names and file paths are string values.
  • Number: a number must lie between +2.147.483.647 and ‑2.147.483.648. Numbers can also be written as hex numbers. In that case they must start with 0x or 0X.
  • Boolean: a Boolean is either True or False (case-insensitive).
  • A command consists of a name followed by parameters and closed with a semicolon. Each parameter in a command has a name and a value between braces.

  • Functions: KCM Core supports a set of built-in functions that you can use wherever an expression is expected. Functions receive a list of comma-separated parameters as input and return a single value as their result. The parameters are enclosed in braces. The names of the functions are case-sensitive.

Parameter, constant, and variable names must comply with the following rules:

  • A name consists of any sequence of alphanumeric characters and the underscore (A-Z, a-z, 0-9 and _) A name cannot begin with a digit.
  • The following keywords cannot be used as names: NOT, not, FI, fi, ELSE, else, ELIF, elif, OD, od, TRUE, true, FALSE, false. These keywords are case-insensitive.
  • The symbolic names of variables, parameters, and constants must be unique within their script.
  • Names are case-sensitive.