21.11.2014 Views

Programming Manual for Citizen BASIC Interpreter - MaRCo

Programming Manual for Citizen BASIC Interpreter - MaRCo

Programming Manual for Citizen BASIC Interpreter - MaRCo

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>Citizen</strong> <strong>BASIC</strong> <strong>Interpreter</strong><br />

Contents<br />

1. <strong>BASIC</strong> <strong>Interpreter</strong> Environment ....................................6<br />

1.1 Overview .......................................................6<br />

1.2 Start Basic <strong>Interpreter</strong> ........................................6<br />

1.3 <strong>BASIC</strong> <strong>Interpreter</strong> Mode .........................................6<br />

1.4 End <strong>BASIC</strong> <strong>Interpreter</strong>..........................................7<br />

1.5 Example of <strong>BASIC</strong> Program .......................................7<br />

2. <strong>BASIC</strong> Language ...................................................9<br />

2.1 Syntactic Element..............................................9<br />

2.1.1 Basic Syntactic Element ....................................9<br />

2.1.2 Identifier .................................................9<br />

2.1.3 Reserved Word .............................................10<br />

2.1.4 Numeral ...................................................10<br />

2.1.5 Line Number ...............................................11<br />

2.1.6 String ....................................................11<br />

2.2 Formula.......................................................11<br />

2.2.1 Operator ..................................................11<br />

2.2.2 Arithmetic Operator .......................................12<br />

2.2.3 Logic Operator ............................................12<br />

2.2.4 Logic Operator (Bit Operator) .............................12<br />

2.2.5 String Operator ...........................................13<br />

2.2.6 Relational Operator .......................................13<br />

2.2.7 Priority of Operator ......................................13<br />

2.2.8 Function Call .............................................14<br />

2.3 Statement .....................................................14<br />

2.3.1 Assignment Statement ......................................14<br />

2.3.2 Function Call .............................................14<br />

2.3.3 GOTO Statement ............................................14<br />

2.3.4 Structured Statement ......................................15<br />

2.3.5 IF Statement ..............................................15<br />

2.3.6 Control Loop ..............................................16<br />

2.3.7 REPEAT Statement ..........................................16<br />

2.3.8 WHILE Statement ...........................................16<br />

2.3.9 DO Statement ..............................................17<br />

2.3.10 FOR Statement ............................................17<br />

2.4 Data Type and Variable ........................................18<br />

2.4.1 Type ......................................................18<br />

2.4.2 Integer Type ..............................................18<br />

2.4.3 String Type ...............................................18<br />

2.4.4 Array Type ................................................18<br />

2.5 Variable ......................................................19<br />

2.5.1 Variable Declaration ......................................19<br />

2.6 Constant ......................................................19<br />

2.6.1 Integer Type Constant .....................................19<br />

2.6.2 String Type Constant ......................................19<br />

2.7 Function ......................................................19<br />

3. Command .........................................................19<br />

3.1 File Name .....................................................20<br />

3.1.1 Program Store Drive .......................................20<br />

3.1.2 File Name Convention ......................................20<br />

3.2 Input-Output Device ...........................................20<br />

3.2.1 List of Devices ...........................................20<br />

3.2.2 Console Device ............................................20<br />

2

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

Saved successfully!

Ooh no, something went wrong!