Nano-C is a small subset of μC, which is itself a small subset of C.
It is intended to serve as an intermediate milestone for some of your
programming assignments rather than as a compilation goal in itself; for this
reason this document specifies nano-C somewhat informally.
The Language
Nano-C programs are limited to the following features of μC:
Variables:
Globals: variables of type int or char.
Locals: at most one formal parameter; no additional local variables.
Statements:
a sequence of zero or more assignments and procedure calls only (i.e., no
if, for, while statements), with these additional
restrictions:
The right-hand-side of an assignment statement is a variable or a constant.
A procedure call takes at most one argument.
Expressions:
scalar variables and constants of type int or char
(i.e., no operators or function calls).
Examples
The following are some examples of nano-C programs.
Example 1
int x;
void foo(void)
{
x = 0;
}
Example 2
int x, y;
char z;
extern void println(int z);
void f(int x)
{
x = 1;
z = x;
}