Download NQC Programmer`s Guide

Transcript
Contents
1
Introduction................................................................................................................. 1
2
The NQC Language .................................................................................................... 2
2.1
Lexical Rules ...................................................................................................... 2
2.1.1
Comments ................................................................................................... 2
2.1.2
Whitespace.................................................................................................. 3
2.1.3
Numerical Constants................................................................................... 3
2.1.4
Identifiers and Keywords............................................................................ 3
2.2
Program Structure ............................................................................................... 4
2.2.1
Tasks ........................................................................................................... 4
2.2.2
Functions..................................................................................................... 5
2.2.3
Subroutines ................................................................................................. 8
2.2.4
Variables ..................................................................................................... 9
2.2.5
Arrays........................................................................................................ 11
2.3
Statements ......................................................................................................... 11
2.3.1
Variable Declaration ................................................................................. 12
2.3.2
Assignment ............................................................................................... 12
2.3.3
Control Structures ..................................................................................... 13
2.3.4
Access Control and Events ....................................................................... 16
2.3.5
Other Statements....................................................................................... 18
2.4
2.4.1
Expressions ....................................................................................................... 19
2.5
Conditions ................................................................................................. 21
2.5.1
The Preprocessor............................................................................................... 22
#include..................................................................................................... 22
Page i