Appendix E:

Small C Quick Reference Guide

This guide is not a formal definition of the Small C language. Rather, it is intended to provide quickly accessible information about the syntax of the language. Generic terms are written as one or more words in italics with the leading letter of each word capitalized. Keywords and special characters in boldface are required by the syntax. The word String implies a sequence of characters written together. The word List implies a series of the preceding item separated by commas and option al white space. The ellipsis (...) implies the optional repetition of occurrences of the preceding type of item. A question mark at the end of an item means that the item is optional, it may be omitted.

LANGUAGE SYNTAX

ArgumentDeclaration: 
	ObjectDeclaration 
ArgumentList: 
	NameList 
Directive: 
	#include "Filename" 
	#include <Filename> 
	#include Filename 
	#define Name CharacterString?... 
	#ifdef Name 
	#ifndef Name 
	#else 
	#endif 
	#asm 
	#endasm 
Constant: 
	Integer 
	'Character '			(escape sequence allowed) 
	'Character Character'		(escape sequences allowed) 
ConstantExpression: 
	Constant 
	Operator ConstantExpression 
	ConstantExpression Operator ConstantExpression 
	( ConstantExpression ) 
Declarator: 
	Object Initializer?		(global initializers only) 
EscapeSequence: 
	\n	(newline) 
	\t	(tab) 
	\b	(backspace) 
	\f	(formfeed) 
	\        OctalInteger 
	\        OtherCharacter 
Expression: 
	Primary 
	Operator Expression 
	Expression Operator 
	Expression Operator Expression 
FunctionDeclaration: 
	void? 
	Name (ArgumentList? )ArgumentDeclaration?...  CompoundStatement 
GlobalDeclaration: 
	ObjectDeclaration 
	FunctionDeclaration 
Initializer: 
	= ConstantExpression 
	= {ConstantExpressionList } 
	= StringConstant 
Object: 
	Name 
	 *Name 
	Name [ ConstantExpression? ] 
	Name () 
	(*Name )()			(arguments and locals only) 
ObjectDeclaration: 
	Type DeclaratorList ; 
	extern Type? DeclaratorList ;	(global only) 
Primary: 
	Name 
	Constant 
	StringConstant 
	Name [ Expression ] 
	Primary ( ExpressionList? ) 
	( Expression ) 
Program: 
	Directive... 
	GlobalDeclaration... 
Statement: 
	; 
	ExpressionList ; 
	return ExpressionList? ; 
	Name : 
	goto Name ; 
	if ( ExpressionList ) Statement 
	if  ( ExpressionList )Statement else  Statement 
	switch ( ExpressionList ) CompoundStatement 
	case ConstantExpression : 
	default : 
	break ; 
	while ( ExpressionList ) Statement 
	for ( ExpressionList? ; ExpressionList? ; ExpressionList? ) Statement 
	do Statement while ( ExpressionList ) 
	; 
	continue ; 
	{ ObjectDeclaration?... Statement?... } 
StringConstant: 
                 " CharacterString "		(escape sequences allowed) 
Type: 
	char 
	int 
	unsigned 
	unsigned char 
	unsigned int 

Go to Appendix F Return to Table of Contents