Constant Declarations

Syntax

ConstantDeclaration =
     "$const" [ ConstDecl { "," ConstDecl } ] ";".
ConstDecl = ExpressionName "=" ConstantExpression.
ConstantExpression =
     { ConstantTerm | NamedExpression }.
ConstantTerm =
     StaticSymbol | "(" ConstantExpression ")".

Purpose

Constant declarations enable ground expressions to be denoted by symbolic names to be used instead of the expressions. A symbolic name is an identifier. If a ground expression has been given a name N, the construct &N is a representation of the expression Ge.

A constant declaration may contain references to previous declarations of constants, boxes, tables, channels, and functions.

Examples

The declaration
$const Lf = 10, Cr = 13, ABC = A B C;
gives names to three ground expressions, so that &Lf denotes 10, &Cr denotes 13, and &ABC denotes A B C.
The declaration
$const CrLf_ABC = &Cr &Lf &ABC;
gives a name to an expression, so that &CrLf_ABC stands for 13 10 A B C.
Related concepts
Static and Dynamic Symbols
Expression Names
Named Ground Expressions