Large groups of people sharing a common interest or goal accomplish one thing at the very least: they develop jargon. After spending any significant period of time working with computers, one cannot help but notice that software engineers are particularly fond of the language they use to communicate ideas about programming. The terms employed for discussing programming languages offer a technical vocabulary with which specific ideas can be communicated clearly and concisely.
Here we introduce some programming language terminology that will be used throughout the book. Table 2-1 provides precise definitions for concepts that are often only vaguely understood. These terms will be used throughout the following chapters.
Name |
Definition |
Examples |
---|---|---|
Token |
The smallest indivisible lexical unit of the language. A contiguous sequence of characters whose meaning would change if separated by a space. |
All identifiers and keywords are tokens, as are literals like 3.14 and "This is a string". |
Literal |
A value found directly in the script. |
3.14 |
Identifier |
The name of a variable, object, function, or label. |
X |
Operator |
Tokens that perform built-in language operations like assignment, addition, and subtraction. |
= |
Expression |
A group of tokens, often literals or identifiers, combined with operators that can be evaluated to a specific value. |
2.0 |
Statement |
An imperative command. Statements usually cause the state of the execution environment (a variable, definition, or the flow of execution) to change. A program is simply a list of statements. |
x = x + 2; |
Keyword |
A word that is a part of the language itself. Keywords may not be used as identifiers. |
while
|
Reserved Word |
A word that might become a part of the language itself. Reserved words may not be used as identifiers, although this restriction is sometimes not strictly enforced. |
class |