Home

Expressions

An expression is a symbolic representation that can be evaluated to yield a value. The term is used in mathematics, computer science, and linguistics with related but distinct meanings. In mathematics, expressions are combinations of constants, variables, and operations that denote a value when the variables are given specific numbers. In programming languages, an expression is a syntactic unit that can be evaluated to produce a value, and it may involve literals, variables, operators, function calls, and sometimes side effects. In linguistics, an expression refers to any utterance or conventional form that conveys meaning, such as a phrase, clause, or sentence.

Key features include syntax and semantics, evaluation rules, and context dependence. Expressions may be classified by

Examples illustrate differences across domains. Mathematics: 2x + 3, sqrt(a^2 + b^2). Programming: x + y * 2; "Hello" + "World"

type,
such
as
numeric,
boolean,
or
string
expressions,
and
by
arity:
unary,
binary,
or
n-ary
operators.
Operator
precedence
and
associativity
determine
the
order
of
evaluation.
In
programming,
expressions
may
be
pure
(no
side
effects)
or
may
produce
side
effects,
and
many
languages
distinguish
expressions
from
statements.
In
some
languages,
assignment
is
an
expression;
in
others,
it
is
a
statement.
in
languages
that
support
string
concatenation;
boolean:
a
&&
b;
relational:
x
>
y.
In
compiler
and
interpreter
design,
expressions
are
often
represented
as
abstract
syntax
trees
and
evaluated
by
an
evaluation
function.
Expressions
can
often
be
simplified
to
a
reduced
or
normal
form,
and
it
helps
to
distinguish
them
from
equations,
which
assert
equality
rather
than
compute
a
value.