Syntax conventions, Neuron c external declarations – Echelon Neuron C User Manual
Page 224
204
Syntax Summary
Syntax Conventions
In this syntax section, syntactic categories (nonterminals) are indicated by
italic
type, and literal words and character set members (terminals) by bold type. In
the example below,
basic-net-var
is a nonterminal, meaning it represents a
syntactic category, or construct, rather than a literal string of characters to be
typed. The symbols network, input, and output are terminals, meaning they are
to be typed in exactly as shown.
basic-net-var
:
network input
network output
A colon (:) following a nonterminal introduces its definition. Alternative
definitions for a nonterminal are listed on separate, consecutive lines, except
when prefaced by the phrase “one of,” and the alternatives are then shown
separated by a vertical bar. The example above shows two alternative definitions
on separate lines. The example below shows two alternative definitions using the
“one of” notation style.
assign-op
:
one
of
= | |= | ^= | &= | <<= | >>=
/= | *= | %= | += | -=
When a definition of a nonterminal has an optional component, that optional
component is shown inside square brackets, like this: [
optional-component
].
The following example demonstrates this concept. The square brackets are not to
be typed, and are not part of the syntax. They merely indicate that the keyword
repeating is optional, rather than required.
timer-type
:
mtimer [ repeating ]
stimer
[ repeating ]
Neuron C External Declarations
The language consists of basic blocks, called “external declarations”.
Neuron-C-program
:
Neuron-C-program external-declaration
external-declaration
The external declarations are ANSI C declarations like data and function
declarations, and Neuron C extensions like I/O object declarations, functional
block declarations, and task declarations.
external-declaration
:
ANSI-C-declaration
Neuron-C-declaration
ANSI-C-declaration
:
;
(C language permits extra semicolons)
data-declaration
;
function-declaration