EUROPEAN ORGANIZATION FOR NUCLEAR RESEARCH

Statements

and

Comments

Input for MAD-X follows in broad lines the new MAD-9 format, i.e. free format with commas "," as separators; however, outside {...} enclosures blanks may be used as separators. Blank input lines do not affect program execution. The input is not case sensitive except for strings enclosed in " ".

The input file consists of a sequence of commands, also known as statements. A statement may occupy any number of input lines. It must be terminated by a semicolon, except if it contains a block of statements itself, like in

if (a < 3) {a=b^2; b=2*b+4;}
Several statements may be placed on the same line. When a "!" or "//" is found on an input line, the remaining characters of the line are skipped. A line "/*" starts a comment region, it ends with a "*/" line. The general format for a command is (items enclosed in /rep/ ... /rep/ can be repeated any number of times, including zero):
label: keyword /rep/,attribute/rep/ ;
It has three parts: If a value has to be assigned to an attribute, the attribute name is mandatory. For logical attributes it is sufficient to enter the name only. The attribute is then given a default value taken from the command dictionary.

Example: TILT attribute for various magnets.

The command attributes can have one of the following types:

Any integer or real attribute can be replaced by a real expression; expressions are normally deferred (see deferred expression), except in the definition of constants where they are evaluated immediately. When a command has a label, MAD-X keeps it in memory. This allows repeated execution of the same command by just entering EXEC label. This construct may be nested. For an exhaustive list of valid declarations of constants or variables see declarations.

hansg, May 8, 2001