MAXScript Introduction > Syntax Definitions in This Document >

# Syntax Definitions in This Document

The ways you can write MAXScript tokens and clauses are given using a set of shorthand rules as shown in the following example:

    [-]{<digit>}[.{<digit>}][(e|E)[+|-]{<digit>}+]

These rules, or syntax definitions, follow the standard EBNF notation (Extended Backus-Naur Form).

The previous example shows the syntax for a decimal number in MAXScript. The rules typically contain a number of characters with special meanings. For example, brackets enclose optional items, such as the minus sign in front of the number. Braces enclose items you can use repeatedly, and bars separate multiple items from which you can choose one. Sometimes, rules are given names so they can be referred to in the documentation or as parts of other rules. The special characters in the rules have the following meaning:

Characters | Meaning
[...] | items inside the brackets are optional
(...|...|...) | choose one of the items separated by the bars
{...} | you can specify the braced item ZERO or more times
{...}+ | you can specify the braced item ONE or more times
::= | define a name for a syntax rule
<rule> | you can insert what is defined by the named rule
bold_characters | characters or token as written

The previous number syntax example is interpreted as follows:

Syntax | Definition
[-]{<digit>} | an optional minus sign (the sign), followed by 0 or more digits (the integer part), followed by
[.{<digit>}] | an optional sequence (the fraction part) comprised of: a period character, followed by 0 or more digits, followed by
[(e|E)[+|-]{<digit>}+] | an optional sequence (the exponent part) comprised of: either an ’r;e’ or ’r;E’, followed by an optional plus or minus sign, followed by one or more digits.

Examples of valid numbers are:

EXAMPLES OF VALID NUMBERS ARE:
    123
    1.456
    -0.89e-7
    1.536E23

THE FOLLOWING NUMBERS ARE NOT VALID:
    12x34
    -0.45x10^3
    0e

The syntax definitions in MAXScript Grammar are in the form of named rule definitions.

FOR EXAMPLE
    number ::= [-]{<digit>}[.{<digit>}](e|E)[+|-]{<digit>}+]
allowing the rule to be referred to by name in other rules in the grammar.
AN EXAMPLE OF SUCH RULE IS:
    mod <number1> <number2>
modulo arithmetic, the remainder when <number1> is divided by <number2>

Some definitions throughout this document also use the convention of showing alternative definitions for a rule on consecutive lines instead of separating them with the ' | ' symbol.

#### See Also

- Index vs Integer Function Arguments