Chapter 5: maxl program language, 1 lexical conventions, 1 comments – ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 63

Advertising
background image

Chapter 5: MAXL Program Language

This chapter describes how to write

Maestro

programs using the MAXL programming

language.

5.1

Lexical Conventions

This section includes the fundamental elements of a MAXL (Multi Axis Language)
program, as they are interpreted by the compiler. These elements, called “lexical
elements” or “tokens”, are used to construct statements, definitions, declarations, and
so on, which are used to make programs. Tokens include:

• Comments

• Identifiers

• MAXL keywords

• Punctuations

• Operations

5.1.1

Comments

A comment is text that the compiler ignores but that is useful to programmers.
Comments are normally used to annotate code for future reference. The compiler
treats them as white space. You can use comments in testing to make certain lines of
code inactive.

MAXL comments (as with C++) are written in one of the following ways:

• /* (slash, asterisk) characters, followed by any sequence of characters

(including new lines), followed by the */ characters. This syntax is the
same as ANSI C.

• // (two slashes) characters, followed by any sequence of characters. A

new line not immediately preceded by a backslash terminates this form of
comment. This is commonly called a “single-line comment” (as in ANSI
C++).

The comment characters (/*, */, and //) have no special meaning within a character
constant, string literal, or comment. Comments using the first syntax, therefore, cannot
be nested. Consider this example:

/* Intent: Comment out this block of code.

Problem: Nested comments on each line of code are illegal.

a = b*56 /* Initialize file string */

b=a/17; c=b*cos(alfa) /* Print status message */

*/

Maestro

Software Manual

MAN-MASSW (Ver. Q)

5-1

Advertising