Basic Definitions


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.

Table 2-1: Basic Terminology of Programming Languages

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
"This is a string"
[2, 4, 6]

Identifier

The name of a variable, object, function, or label.

X
myValue
username

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
"This is a string"
(x + 2) * 4

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;
return(true);
if (x) { alert("It's x");}
function myFunc()
{
alert("Hello there");
}

Keyword

A word that is a part of the language itself. Keywords may not be used as identifiers.

while
do
function
var

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
public




JavaScript 2.0
JavaScript: The Complete Reference, Second Edition
ISBN: 0072253576
EAN: 2147483647
Year: 2004
Pages: 209

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net