18.10.2014 Views

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Programming</strong> <strong>Language</strong> Concepts<br />

Figure 2-8. A Complex Tree<br />

The ability to use the dim.f function makes it easy to allow each node to have several branches,<br />

rather than only two. Such a tree might look like figure 2-8.<br />

2.24 Pre-Processing Program Text<br />

In the interests of readability, <strong>SIMSCRIPT</strong> <strong>II.5</strong> provides two program text substitution facilities.<br />

The first allows a defined sequence of words to be substituted for a single word. The statement:<br />

word to mean sequence of words<br />

means that each occurrence of word in the program text is replaced, before interpretation, by a sequence<br />

of characters. The word to be replaced may be any name, single character, or sequence of<br />

characters not containing a blank. However, only clearly identifiable occurrences are replaced.<br />

Embedded occurrences in other strings are not extracted for replacement. The string to be substituted<br />

may be any sequence of characters or words, delimited by the end of a statement line. It may<br />

contain embedded blanks. Comment text is not affected. This feature provides, for instance, the<br />

ability to represent the constants that frequently appear in programs as meaningful names. Including<br />

such definitions, for example, as:<br />

define .IDLE.STATUS to mean 0<br />

define .BUSY.STATUS to mean 1<br />

define .DOWNSTREAM to mean 2<br />

allows statements to be written as:<br />

if STATUS.CODE = .BUSY.STATUS<br />

or DIRECTION = .DOWNSTREAM<br />

let STATUS = .IDLE.STATUS<br />

while being interpreted as:<br />

81

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!