HPlogo HP C/HP-UX Reference Manual: Workstations and Servers > Chapter 2 Lexical Elements

Tokens

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

A token is the smallest lexical element of the C language.

Syntax

token ::= keyword
identifier
constant
string-literal
operator
punctuator

Description

The compiler combines input characters together to form the longest token possible when collecting characters into tokens. For example, the sequence integer is interpreted as a single identifier rather than the reserved keyword int followed by the identifier eger.

A token cannot exceed 509 characters in length. Consecutive source code lines can be concatenated together using the backslash (\) character at the end of the line to be continued. The total number of characters in the concatenated source lines cannot exceed 509.

The term white space refers to the set of characters that includes spaces, horizontal tabs, newline characters, vertical tabs, form feeds, and comments. You can use white space freely between tokens, and extra spaces are ignored in your programs. But note that at least one space may be required to separate tokens. So, a character such as a hyphen (-) can take on different meanings depending upon the white space around it.

For example:

a- -1

is different from

a--1