TMCALGO R1: Algorithm Compiler
Note: this document does not refer to the latest version of
the TMCALGO language. Please refer to TMCALGO R2
for the latest documentation.
Contents
0.0: Invocation
A.0: Syntax
A.1: Grammar
A.2: Lexical Syntax
0.0: Invocation
tmcalgo [options] [files]
-k Keep output file (.c) even on error
-o <filename> Send .tmc output to named file
-v Produce Debug Messages
-q Show this help message
-w Give error return on warnings
-C <node> Look for command server on specified node
A.0: Syntax
Following is a list of rules for interpreting the
TMCALGO Input Grammar specification followed
by the TMCALGO Input Grammar
specification itself. Don't confuse these rules with the rules
for interpreting a TMCALGO program, which is what the grammar
defines. Since we're using a grammar to define a program which
is used to define other grammars, there is a heavy dose of
self-referentiation. If you lose your bearings, get outside
and walk fast enough to double your heartrate for at least 20
minutes.
- Items typed in TYPEWRITER font (uppercase) represent
keywords which would be entered explicitly in a TMCALGO program.
- An item typed in lowercase is a non-terminal. The grammar
recursively defines how non-terminals can be expanded. For
example, the non-terminal rules can be
expanded by zero or more rule non-terminals,
and so on. Each line beginning with an indented colon (:) marks
a possible expansion of the non-terminal being defined. Within
an one of these expansions, each reference to a non-terminal is
a link to that non-terminal's definition.
- Items bracketed by angle brackets (e.g.
<INTEGER>) are lexical tokens. Their syntax should be implicit in
their names.
- I have used brackets ([]) to signify optional items. I use the
notation [ item ... ] to indicate that an optional item may be
repreated indefinitely. The colon (:)
at the beginning of a line identifies a non-terminal expansion
(right-hand-side).
Literal punctuation is enclosed in single quotes ('*').
A.1: TMCALGO Input Grammar
program
: [ prog-item ... ]
prog-item
: <TMC-STATEMENT>
: STATE <NAME> '{' untimed-commands timed-commands '}'
: PARTITION
untimed-commands
: [ <TMC-STATEMENT> ... ]
timed-commands
: [ [ [ '+' ] time ] command ... ]
time
: <INTEGER> [ ':' <INTEGER> ... ]
command
: <TEXT-COMMAND>
: <TMC-STATEMENT>
A.2: TMCALGO Lexical Syntax
- <TEXT-COMMAND>
- A text command is a written instrument command prefixed by a right
angle-bracket (>). The syntax must match that of the command
client/server pair. For example:
> Lamp On
- <TMC-STATEMENT>
- As you might guess, a TMC statement bracketed
by, well, brackets ([ ]). The syntax is not checked until TMC gets it.
For example:
[ validate lamp_is_on; ]
- <INTEGER>
- An integer consists of one or more digits.
- <NAME>
- A name is a unique C-style symbol (begins with a letter and
consists of letters, numbers and/or underscore characters) used
to identify the state.
Return to Manuals Guide
(c)1995 Norton T. Allen