Skip to content

14 Program

Syntax

Program :
SourceElements
SourceElements :
SourceElement
SourceElements SourceElement
SourceElement :
Statement FunctionDeclaration

Semantics

The production Program : SourceElements is evaluated as follows:

  1. Process SourceElements for function declarations.
  2. Evaluate SourceElements.
  3. Return Result(2).

The production SourceElements : SourceElement is processed for function declarations as follows:

1. Process SourceElement for function declarations.

The production SourceElements : SourceElement is evaluated as follows:

  1. Evaluate SourceElement.
  2. Return Result(1).

The production SourceElements : SourceElements SourceElement is processed for function declarations as follows:

  1. Process SourceElements for function declarations.
  2. Process SourceElement for function declarations.

The production SourceElements : SourceElements SourceElement is evaluated as follows:

  1. Evaluate SourceElements.
  2. Evaluate SourceElement.
  3. If Result(2) is a value completion, return Result(2).
  4. Return Result(1).

The production SourceElement : Statement is processed for function declarations by taking no action.

The production SourceElement : Statement is evaluated as follows:

  1. Evaluate Statement .
  2. Return Result(1).

The production SourceElement : FunctionDeclaration is processed for function declarations as follows:

1. Process FunctionDeclaration for function declarations.

The production SourceElement : FunctionDeclaration is evaluated as follows:

1. Return "normal completion".