Programming Manual for Citizen BASIC Interpreter - MaRCo
Programming Manual for Citizen BASIC Interpreter - MaRCo
Programming Manual for Citizen BASIC Interpreter - MaRCo
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Citizen</strong> <strong>BASIC</strong> <strong>Interpreter</strong><br />
Operators with higher priority are assessed be<strong>for</strong>e those with lower priority while<br />
those with equal priority are assessed from the left. There<strong>for</strong>e in the <strong>for</strong>mula X+Y*Z,<br />
Y is multiplied by Z to add X to its result. However, in the <strong>for</strong>mula X-Y+Z, Y is<br />
subtracted from x to add Z to its result. Since – and + are equal in their priority,<br />
the left operation is executed first.<br />
Use of brackets allows the rules of priority to override. The <strong>for</strong>mula in brackets<br />
is assessed first to be handled as the single operand subsequently. For instance,<br />
in the <strong>for</strong>mula (X+Y)*Z, the sum of X and Y is multiplied by Z.<br />
2.2.8 Function Call<br />
Function call is a type of a <strong>for</strong>mula since a function returns values. For example,<br />
when MAX returns an integer taking two integer arguments, the function call of<br />
MAX(24,47) is the <strong>for</strong>mula of the integer type.<br />
2.3 Statement<br />
The statement defines algorithmic processing in a program. Combination of simple<br />
statements such as assignment and procedure call allows creating loops, conditional<br />
statements and other structured statements. To separate several statements in a<br />
line, use colons.<br />
2.3.1 Assignment Statement<br />
An assignment statement has the following <strong>for</strong>m:<br />
Variable = <strong>for</strong>mula<br />
An assignment statement is replaced by the value of the current value of the variable.<br />
An example includes:<br />
I=3<br />
This assigns the value 3 to the variable I. Variable reference in the left member<br />
of an assignment statement is available <strong>for</strong> the right-hand <strong>for</strong>mula as shown below:<br />
I=I+1<br />
This increments the value of I.<br />
2.3.2 Function Call<br />
A function is structured by a function name and, if required, a parameter list.<br />
An instance is:<br />
ISERROR<br />
DATAREADY(1)<br />
LEN(A$)<br />
2.3.3 GOTO Statement<br />
A GOTO has the following <strong>for</strong>m:<br />
GOTO line number<br />
A GOTO statement <strong>for</strong>wards program execution to the statement with the designated<br />
14