next up previous contents index
Next: Identifiers or Labels Up: Command Format Previous: Command Format   Contents   Index


Statements and Comments

Input to MAD is free format, and the line length is not limited. During reading, input lines are normally printed on the echo file, but this feature can be turned off for long input files. The input is broken up into tokens (words, numbers, delimiters etc.), which form a sequence of commands, also known as statements. Each statement must be terminated by a semicolon (;), and long statements can be continued on any number of input lines. White space, like blank lines, spaces, tabs, and newlines are ignored between tokens. Comments can be introduced with two slashes (//) and any characters following the slashes on the same line are ignored.

The C convention for comments (/* ... */) is also accepted. The comment delimiters /* and */ can be nested; thus whole section of input can be ``commented out''.

In the following descriptions, words in lower case stand for syntactic units which are to be replaced by actual text. UPPER CASE is used for keywords or names. These must be entered as shown. Ellipses (...) are used to indicate repetition.

The general format for a command is


keyword,attribute,...,attribute;
label:keyword,attribute,...,attribute;
It has three parts:
  1. The label is required for a definition statement. Its must be an identifier and gives a name to the stored command.
  2. The keyword identifies the action desired. It must be an identifier.
  3. Each attribute is entered in one of the forms
    
    attribute-name
    attribute-name=attribute-value
    attribute-name:=attribute-value
    
    and serves to define data for the command, where: Each attribute has a fixed attribute type. The attribute-value can only be left out for logical attributes, this implies a true value.

When a command has a label, MAD keeps the command in memory. This allows repeated execution of the same command by entering its label only:


label;
or to re-execute the command with modified attributes:

label,attribute,...,attribute;
If the label of such a command appears together with new attributes, MAD makes a copy of the stored command, replaces the attributes entered, and then executes the copy:

QF:QUADRUPOLE,L=1,K1=0.01; // first definition of QF
QF,L=2;                    // redefinition of QF, new length

MATCH;
...
LMD:LMDIF,CALLS=10;           // first execution of LMD
LMD;                          // re-execute LMD with the same attributes
LMD,CALLS=100,TOLERANCE=1E-5; // re-execute LMD with new attributes
ENDMATCH;


next up previous contents index
Next: Identifiers or Labels Up: Command Format Previous: Command Format   Contents   Index
MAD User Guide, http://wwwslap.cern.ch/mad/