<s>
Control	B-Application
tables	I-Application
are	O
tables	O
that	O
control	O
the	O
control	O
flow	O
or	O
play	O
a	O
major	O
part	O
in	O
program	O
control	O
.	O
</s>
<s>
There	O
are	O
no	O
rigid	O
rules	O
about	O
the	O
structure	O
or	O
content	O
of	O
a	O
control	B-Application
table	I-Application
—	O
its	O
qualifying	O
attribute	O
is	O
its	O
ability	O
to	O
direct	O
control	O
flow	O
in	O
some	O
way	O
through	O
"	O
execution	O
"	O
by	O
a	O
processor	B-General_Concept
or	O
interpreter	B-Application
.	O
</s>
<s>
The	O
design	O
of	O
such	O
tables	O
is	O
sometimes	O
referred	O
to	O
as	O
table-driven	O
design	O
(	O
although	O
this	O
typically	O
refers	O
to	O
generating	O
code	O
automatically	O
from	O
external	O
tables	O
rather	O
than	O
direct	O
run-time	B-Library
tables	O
)	O
.	O
</s>
<s>
In	O
some	O
cases	O
,	O
control	B-Application
tables	I-Application
can	O
be	O
specific	O
implementations	O
of	O
finite-state-machine-based	O
automata-based	B-Application
programming	I-Application
.	O
</s>
<s>
Control	B-Application
tables	I-Application
often	O
have	O
the	O
equivalent	O
of	O
conditional	B-Language
expressions	I-Language
or	O
function	O
references	O
embedded	O
in	O
them	O
,	O
usually	O
implied	O
by	O
their	O
relative	O
column	O
position	O
in	O
the	O
association	B-Data_Structure
list	I-Data_Structure
.	O
</s>
<s>
Control	B-Application
tables	I-Application
reduce	O
the	O
need	O
for	O
programming	O
similar	O
structures	B-General_Concept
or	O
program	O
statements	O
over	O
and	O
over	O
again	O
.	O
</s>
<s>
The	O
two-dimensional	O
nature	O
of	O
most	O
tables	O
makes	O
them	O
easier	O
to	O
view	O
and	O
update	O
than	O
the	O
one-dimensional	O
nature	O
of	O
program	B-Language
code	I-Language
.	O
</s>
<s>
In	O
some	O
cases	O
,	O
non-programmers	O
can	O
be	O
assigned	O
to	O
maintain	O
the	O
content	O
of	O
control	B-Application
tables	I-Application
.	O
</s>
<s>
For	O
example	O
,	O
if	O
a	O
user-entered	O
search	O
phrase	O
contains	O
a	O
certain	O
phrase	O
,	O
a	O
URL	O
(	O
web	O
address	O
)	O
can	O
be	O
assigned	O
in	O
a	O
table	B-Data_Structure
that	O
controls	O
where	O
the	O
search	O
user	O
is	O
taken	O
.	O
</s>
<s>
If	O
the	O
phrase	O
contains	O
"	O
skirt	O
"	O
,	O
then	O
the	O
table	B-Data_Structure
can	O
route	O
the	O
user	O
to	O
"	O
www.shopping.example/catalogs/skirts	O
"	O
,	O
which	O
is	O
the	O
skirts	O
product	O
catalog	O
page	O
.	O
</s>
<s>
Marketing	O
personnel	O
may	O
manage	O
such	O
a	O
table	B-Data_Structure
instead	O
of	O
programmers	O
.	O
</s>
<s>
The	O
tables	O
can	O
have	O
multiple	O
dimensions	O
,	O
of	O
fixed	O
or	O
variable	O
lengths	O
and	O
are	O
usually	O
portable	B-Architecture
between	O
computer	B-Device
platforms	I-Device
,	O
requiring	O
only	O
a	O
change	O
to	O
the	O
interpreter	B-Application
,	O
not	O
the	O
algorithm	O
itself	O
–	O
the	O
logic	O
of	O
which	O
is	O
essentially	O
embodied	O
within	O
the	O
table	B-Data_Structure
structure	O
and	O
content	O
.	O
</s>
<s>
The	O
structure	O
of	O
the	O
table	B-Data_Structure
may	O
be	O
similar	O
to	O
a	O
multimap	B-Application
associative	B-Application
array	I-Application
,	O
where	O
a	O
data	O
value	O
(	O
or	O
combination	O
of	O
data	O
values	O
)	O
may	O
be	O
mapped	O
to	O
one	O
or	O
more	O
functions	O
to	O
be	O
performed	O
.	O
</s>
<s>
In	O
perhaps	O
its	O
simplest	O
implementation	O
,	O
a	O
control	B-Application
table	I-Application
may	O
sometimes	O
be	O
a	O
one-dimensional	O
table	B-Data_Structure
for	O
directly	O
translating	O
a	O
raw	O
data	O
value	O
to	O
a	O
corresponding	O
subroutine	O
offset	B-General_Concept
,	O
index	B-Data_Structure
or	O
pointer	O
using	O
the	O
raw	O
data	O
value	O
either	O
directly	O
as	O
the	O
index	B-Data_Structure
to	O
the	O
array	B-Data_Structure
,	O
or	O
by	O
performing	O
some	O
basic	O
arithmetic	O
on	O
the	O
data	O
beforehand	O
.	O
</s>
<s>
This	O
can	O
be	O
achieved	O
in	O
constant	O
time	O
(	O
without	O
a	O
linear	B-Algorithm
search	I-Algorithm
or	O
binary	O
search	O
using	O
a	O
typical	O
lookup	B-Data_Structure
table	I-Data_Structure
on	O
an	O
associative	B-Application
array	I-Application
)	O
.	O
</s>
<s>
In	O
most	O
architectures	O
,	O
this	O
can	O
be	O
accomplished	O
in	O
two	O
or	O
three	O
machine	B-Language
instructions	I-Language
–	O
without	O
any	O
comparisons	O
or	O
loops	O
.	O
</s>
<s>
The	O
technique	O
is	O
known	O
as	O
a	O
"	O
trivial	B-Data_Structure
hash	I-Data_Structure
function	I-Data_Structure
"	O
or	O
,	O
when	O
used	O
specifically	O
for	O
branch	O
tables	O
,	O
"	O
double	B-Language
dispatch	I-Language
"	O
.	O
</s>
<s>
an	O
ASCII	B-Protocol
or	O
EBCDIC	B-Language
character	O
value	O
which	O
have	O
a	O
range	O
of	O
hexadecimal	O
'	O
00	O
 '	O
–	O
'	O
FF	O
 '	O
.	O
</s>
<s>
If	O
the	O
actual	O
range	O
is	O
guaranteed	O
to	O
be	O
smaller	O
than	O
this	O
,	O
the	O
array	B-Data_Structure
can	O
be	O
truncated	O
to	O
less	O
than	O
256	O
bytes	O
)	O
.	O
</s>
<s>
In	O
automata-based	B-Application
programming	I-Application
and	O
pseudoconversational	B-Application
transaction	I-Application
processing	O
,	O
if	O
the	O
number	O
of	O
distinct	O
program	O
states	O
is	O
small	O
,	O
a	O
"	O
dense	O
sequence	O
"	O
control	B-General_Concept
variable	I-General_Concept
can	O
be	O
used	O
to	O
efficiently	O
dictate	O
the	O
entire	O
flow	O
of	O
the	O
main	O
program	O
loop	O
.	O
</s>
<s>
A	O
two	O
byte	O
raw	O
data	O
value	O
would	O
require	O
a	O
minimum	O
table	B-Data_Structure
size	O
of	O
65,536	O
bytes	O
–	O
to	O
handle	O
all	O
input	O
possibilities	O
–	O
whilst	O
allowing	O
just	O
256	O
different	O
output	O
values	O
.	O
</s>
<s>
However	O
,	O
this	O
direct	O
translation	O
technique	O
provides	O
an	O
extremely	O
fast	O
validation	O
&	O
conversion	O
to	O
a	O
(	O
relative	O
)	O
subroutine	B-Language
pointer	I-Language
if	O
the	O
heuristics	B-Algorithm
,	O
together	O
with	O
sufficient	O
fast	O
access	O
memory	O
,	O
permits	O
its	O
use	O
.	O
</s>
<s>
A	O
branch	O
table	B-Data_Structure
is	O
a	O
one-dimensional	O
'	O
array	B-Data_Structure
 '	O
of	O
contiguous	O
machine	B-Language
code	I-Language
branch/jump	B-General_Concept
instructions	O
to	O
effect	O
a	O
multiway	O
branch	O
to	O
a	O
program	O
label	O
when	O
branched	O
into	O
by	O
an	O
immediately	O
preceding	O
,	O
and	O
indexed	O
branch	O
.	O
</s>
<s>
It	O
is	O
sometimes	O
generated	O
by	O
an	O
optimizing	B-Application
compiler	I-Application
to	O
execute	O
a	O
switch	O
statement	O
–	O
provided	O
that	O
the	O
input	O
range	O
is	O
small	O
and	O
dense	O
,	O
with	O
few	O
gaps	O
(	O
as	O
created	O
by	O
the	O
previous	O
array	B-Data_Structure
example	O
)	O
.	O
</s>
<s>
Although	O
quite	O
compact	O
–	O
compared	O
to	O
the	O
multiple	O
equivalent	O
If	O
statements	O
–	O
the	O
branch	B-General_Concept
instructions	I-General_Concept
still	O
carry	O
some	O
redundancy	O
,	O
since	O
the	O
branch	O
opcode	B-Language
and	O
condition	O
code	O
mask	O
are	O
repeated	O
alongside	O
the	O
branch	O
offsets	B-General_Concept
.	O
</s>
<s>
Control	B-Application
tables	I-Application
containing	O
only	O
the	O
offsets	B-General_Concept
to	O
the	O
program	O
labels	O
can	O
be	O
constructed	O
to	O
overcome	O
this	O
redundancy	O
(	O
at	O
least	O
in	O
assembly	B-Language
languages	I-Language
)	O
and	O
yet	O
requiring	O
only	O
minor	O
execution	B-Library
time	I-Library
overhead	O
compared	O
to	O
a	O
conventional	O
branch	O
table	B-Data_Structure
.	O
</s>
<s>
More	O
usually	O
,	O
a	O
control	B-Application
table	I-Application
can	O
be	O
thought	O
of	O
as	O
a	O
Truth	O
table	B-Data_Structure
or	O
as	O
an	O
executable	O
(	O
"	O
binary	O
"	O
)	O
implementation	O
of	O
a	O
printed	O
decision	O
table	B-Data_Structure
(	O
or	O
a	O
tree	B-Application
of	O
decision	O
tables	O
,	O
at	O
several	O
levels	O
)	O
.	O
</s>
<s>
These	O
actions	O
are	O
usually	O
performed	O
by	O
generic	B-Language
or	O
custom-built	O
subroutines	O
that	O
are	O
called	O
by	O
an	O
"	B-Application
interpreter	I-Application
"	I-Application
program	O
.	O
</s>
<s>
The	O
interpreter	B-Application
in	O
this	O
instance	O
effectively	O
functions	O
as	O
a	O
virtual	B-Architecture
machine	I-Architecture
,	O
that	O
'	O
executes	O
 '	O
the	O
control	B-Application
table	I-Application
entries	O
and	O
thus	O
provides	O
a	O
higher	O
level	O
of	O
abstraction	B-Application
than	O
the	O
underlying	O
code	O
of	O
the	O
interpreter	B-Application
.	O
</s>
<s>
A	O
control	B-Application
table	I-Application
can	O
be	O
constructed	O
along	O
similar	O
lines	O
to	O
a	O
language	B-Language
dependent	O
switch	O
statement	O
but	O
with	O
the	O
added	O
possibility	O
of	O
testing	O
for	O
combinations	O
of	O
input	O
values	O
(	O
using	O
boolean	O
style	O
AND/OR	O
conditions	O
)	O
and	O
potentially	O
calling	O
multiple	O
subroutines	O
(	O
instead	O
of	O
just	O
a	O
single	O
set	O
of	O
values	O
and	O
'	O
branch	O
to	O
 '	O
program	O
labels	O
)	O
.	O
</s>
<s>
(	O
The	O
switch	O
statement	O
construct	O
in	O
any	O
case	O
may	O
not	O
be	O
available	O
,	O
or	O
has	O
confusingly	O
differing	O
implementations	O
in	O
high	B-Language
level	I-Language
languages	I-Language
(	O
HLL	B-Language
)	O
.	O
</s>
<s>
The	O
control	B-Application
table	I-Application
concept	O
,	O
by	O
comparison	O
,	O
has	O
no	O
intrinsic	O
language	B-Language
dependencies	O
,	O
but	O
might	O
nevertheless	O
be	O
implemented	O
differently	O
according	O
to	O
the	O
available	O
data	O
definition	O
features	O
of	O
the	O
chosen	O
programming	O
language	B-Language
.	O
)	O
</s>
<s>
A	O
control	B-Application
table	I-Application
essentially	O
embodies	O
the	O
'	O
essence	O
 '	O
of	O
a	O
conventional	O
program	O
,	O
stripped	O
of	O
its	O
programming	O
language	B-Language
syntax	O
and	O
platform	B-Operating_System
dependent	I-Operating_System
components	O
(	O
e.g.	O
</s>
<s>
IF/THEN	O
DO	O
..	O
,	O
FOR	O
..	O
,	O
DO	O
WHILE	O
..	O
,	O
SWITCH	O
,	O
GOTO	B-Application
,	O
CALL	B-Operating_System
)	O
and	O
'	O
condensed	O
 '	O
to	O
its	O
variables	O
(	O
e.g.	O
</s>
<s>
The	O
structure	O
of	O
the	O
table	B-Data_Structure
itself	O
typically	O
implies	O
the	O
(	O
default	O
)	O
logical	O
operations	O
involved	O
–	O
such	O
as	O
'	O
testing	O
for	O
equality	O
 '	O
,	O
performing	O
a	O
subroutine	O
and	O
'	O
next	O
operation	O
 '	O
or	O
following	O
the	O
default	O
sequence	O
(	O
rather	O
than	O
these	O
being	O
explicitly	O
stated	O
within	O
program	O
statements	O
–	O
as	O
required	O
in	O
other	O
programming	O
paradigms	O
)	O
.	O
</s>
<s>
A	O
multi-dimensional	O
control	B-Application
table	I-Application
will	O
normally	O
,	O
as	O
a	O
minimum	O
,	O
contain	O
value/action	O
pairs	O
and	O
may	O
additionally	O
contain	O
operators	O
and	O
type	O
information	O
such	O
as	O
,	O
the	O
location	O
,	O
size	O
and	O
format	O
of	O
input	O
or	O
output	O
data	O
,	O
whether	O
data	B-General_Concept
conversion	I-General_Concept
(	O
or	O
other	O
run-time	B-Library
processing	O
nuances	O
)	O
is	O
required	O
before	O
or	O
after	O
processing	O
(	O
if	O
not	O
already	O
implicit	O
in	O
the	O
function	O
itself	O
)	O
.	O
</s>
<s>
The	O
table	B-Data_Structure
may	O
or	O
may	O
not	O
contain	O
indexes	O
or	O
relative	O
or	O
absolute	O
pointers	O
to	O
generic	B-Language
or	O
customized	O
primitives	O
or	O
subroutines	O
to	O
be	O
executed	O
depending	O
upon	O
other	O
values	O
in	O
the	O
"	O
row	O
"	O
.	O
</s>
<s>
The	O
table	B-Data_Structure
illustrated	O
below	O
applies	O
only	O
to	O
'	O
input1	O
 '	O
since	O
no	O
specific	O
input	O
is	O
specified	O
in	O
the	O
table	B-Data_Structure
.	O
</s>
<s>
The	O
variety	O
of	O
values	O
that	O
can	O
be	O
encoded	B-Algorithm
within	O
a	O
control	B-Application
table	I-Application
is	O
largely	O
dependent	O
upon	O
the	O
computer	B-Language
language	I-Language
used	O
.	O
</s>
<s>
Assembly	B-Language
language	I-Language
provides	O
the	O
widest	O
scope	O
for	O
data	O
types	O
including	O
(	O
for	O
the	O
actions	O
)	O
,	O
the	O
option	O
of	O
directly	O
executable	O
machine	B-Language
code	I-Language
.	O
</s>
<s>
Typically	O
a	O
control	B-Application
table	I-Application
will	O
contain	O
values	O
for	O
each	O
possible	O
matching	O
class	O
of	O
input	O
together	O
with	O
a	O
corresponding	O
pointer	O
to	O
an	O
action	O
subroutine	O
.	O
</s>
<s>
Some	O
languages	O
claim	O
not	O
to	O
support	O
pointers	O
(	O
directly	O
)	O
but	O
nevertheless	O
can	O
instead	O
support	O
an	O
index	B-Data_Structure
which	O
can	O
be	O
used	O
to	O
represent	O
a	O
'	O
relative	O
subroutine	O
number	O
 '	O
to	O
perform	O
conditional	B-Language
execution	O
,	O
controlled	O
by	O
the	O
value	O
in	O
the	O
table	B-Data_Structure
entry	O
(	O
e.g.	O
</s>
<s>
Comments	O
positioned	O
above	O
each	O
column	O
(	O
or	O
even	O
embedded	O
textual	O
documentation	O
)	O
can	O
render	O
a	O
decision	O
table	B-Data_Structure
'	O
human	O
readable	O
 '	O
even	O
after	O
'	O
condensing	O
down	O
 '	O
(	O
encoding	B-Algorithm
)	O
to	O
its	O
essentials	O
(	O
and	O
still	O
broadly	O
in-line	O
with	O
the	O
original	O
program	O
specification	O
–	O
especially	O
if	O
a	O
printed	O
decision	O
table	B-Data_Structure
,	O
enumerating	B-Language
each	O
unique	O
action	O
,	O
is	O
created	O
before	O
coding	O
begins	O
)	O
.	O
</s>
<s>
Control	B-Application
tables	I-Application
can	O
reside	O
in	O
static	B-General_Concept
storage	O
,	O
on	O
auxiliary	O
storage	O
,	O
such	O
as	O
a	O
flat	B-Application
file	I-Application
or	O
on	O
a	O
database	O
or	O
may	O
alternatively	O
be	O
partially	O
or	O
entirely	O
built	O
dynamically	O
at	O
program	O
initialization	B-Operating_System
time	O
from	O
parameters	O
(	O
which	O
themselves	O
may	O
reside	O
in	O
a	O
table	B-Data_Structure
)	O
.	O
</s>
<s>
For	O
optimum	O
efficiency	B-General_Concept
,	O
the	O
table	B-Data_Structure
should	O
be	O
memory	O
resident	O
when	O
the	O
interpreter	B-Application
begins	O
to	O
use	O
it	O
.	O
</s>
<s>
The	O
interpreter	B-Application
can	O
be	O
written	O
in	O
any	O
suitable	O
programming	O
language	B-Language
including	O
a	O
high	B-Language
level	I-Language
language	I-Language
.	O
</s>
<s>
A	O
suitably	O
designed	O
generic	B-Language
interpreter	B-Application
,	O
together	O
with	O
a	O
well	O
chosen	O
set	O
of	O
generic	B-Language
subroutines	O
(	O
able	O
to	O
process	O
the	O
most	O
commonly	O
occurring	O
primitives	O
)	O
,	O
would	O
require	O
additional	O
conventional	O
coding	O
only	O
for	O
new	O
custom	O
subroutines	O
(	O
in	O
addition	O
to	O
specifying	O
the	O
control	B-Application
table	I-Application
itself	O
)	O
.	O
</s>
<s>
The	O
interpreter	B-Application
,	O
optionally	O
,	O
may	O
only	O
apply	O
to	O
some	O
well-defined	O
sections	O
of	O
a	O
complete	O
application	O
program	O
(	O
such	O
as	O
the	O
main	B-General_Concept
control	I-General_Concept
loop	I-General_Concept
)	O
and	O
not	O
other	O
,	O
'	O
less	O
conditional	B-Language
 '	O
,	O
sections	O
(	O
such	O
as	O
program	O
initialization	B-Operating_System
,	O
termination	O
and	O
so	O
on	O
)	O
.	O
</s>
<s>
The	O
interpreter	B-Application
does	O
not	O
need	O
to	O
be	O
unduly	O
complex	O
,	O
or	O
produced	O
by	O
a	O
programmer	O
with	O
the	O
advanced	O
knowledge	O
of	O
a	O
compiler	O
writer	O
,	O
and	O
can	O
be	O
written	O
just	O
as	O
any	O
other	O
application	O
program	O
–	O
except	O
that	O
it	O
is	O
usually	O
designed	O
with	O
efficiency	B-General_Concept
in	O
mind	O
.	O
</s>
<s>
Its	O
primary	O
function	O
is	O
to	O
"	O
execute	O
"	O
the	O
table	B-Data_Structure
entries	O
as	O
a	O
set	O
of	O
"	O
instructions	O
"	O
.	O
</s>
<s>
There	O
need	O
be	O
no	O
requirement	O
for	O
parsing	O
of	O
control	B-Application
table	I-Application
entries	O
and	O
these	O
should	O
therefore	O
be	O
designed	O
,	O
as	O
far	O
as	O
possible	O
,	O
to	O
be	O
'	O
execution	O
ready	O
 '	O
,	O
requiring	O
only	O
the	O
"	O
plugging	O
in	O
"	O
of	O
variables	O
from	O
the	O
appropriate	O
columns	O
to	O
the	O
already	O
compiled	O
generic	B-Language
code	O
of	O
the	O
interpreter	B-Application
.	O
</s>
<s>
The	O
program	O
instructions	O
are	O
,	O
in	O
theory	O
,	O
infinitely	O
extensible	B-Architecture
and	O
constitute	O
(	O
possibly	O
arbitrary	O
)	O
values	O
within	O
the	O
table	B-Data_Structure
that	O
are	O
meaningful	O
only	O
to	O
the	O
interpreter	B-Application
.	O
</s>
<s>
The	O
control	O
flow	O
of	O
the	O
interpreter	B-Application
is	O
normally	O
by	O
sequential	O
processing	O
of	O
each	O
table	B-Data_Structure
row	O
but	O
may	O
be	O
modified	O
by	O
specific	O
actions	O
in	O
the	O
table	B-Data_Structure
entries	O
.	O
</s>
<s>
These	O
arbitrary	O
values	O
can	O
thus	O
be	O
designed	O
with	O
efficiency	B-General_Concept
in	O
mind	O
–	O
by	O
selecting	O
values	O
that	O
can	O
be	O
used	O
as	O
direct	O
indexes	O
to	O
data	O
or	O
function	B-Language
pointers	I-Language
.	O
</s>
<s>
For	O
particular	O
platforms/language	O
,	O
they	O
can	O
be	O
specifically	O
designed	O
to	O
minimize	O
instruction	B-General_Concept
path	I-General_Concept
lengths	I-General_Concept
using	O
branch	O
table	B-Data_Structure
values	O
or	O
even	O
,	O
in	O
some	O
cases	O
such	O
as	O
in	O
JIT	O
compilers	O
,	O
consist	O
of	O
directly	O
executable	O
machine	B-Language
code	I-Language
"	O
snippets	B-Application
"	O
(	O
or	O
pointers	O
to	O
them	O
)	O
.	O
</s>
<s>
The	O
subroutines	O
may	O
be	O
coded	O
either	O
in	O
the	O
same	O
language	B-Language
as	O
the	O
interpreter	B-Application
itself	O
or	O
any	O
other	O
supported	O
program	O
language	B-Language
(	O
provided	O
that	O
suitable	O
inter-language	O
'	O
Call	B-Operating_System
 '	O
linkage	O
mechanisms	O
exist	O
)	O
.	O
</s>
<s>
The	O
choice	O
of	O
language	B-Language
for	O
the	O
interpreter	B-Application
and/or	O
subroutines	O
will	O
usually	O
depend	O
upon	O
how	O
portable	B-Architecture
it	O
needs	O
to	O
be	O
across	O
various	O
platforms	B-Device
.	O
</s>
<s>
There	O
may	O
be	O
several	O
versions	O
of	O
the	O
interpreter	B-Application
to	O
enhance	O
the	O
portability	B-Architecture
of	O
a	O
control	B-Application
table	I-Application
.	O
</s>
<s>
A	O
subordinate	O
control	B-Application
table	I-Application
pointer	O
may	O
optionally	O
substitute	O
for	O
a	O
subroutine	B-Language
pointer	I-Language
in	O
the	O
'	O
action	O
 '	O
columns	O
if	O
the	O
interpreter	B-Application
supports	O
this	O
construct	O
,	O
representing	O
a	O
conditional	B-Language
'	O
drop	O
 '	O
to	O
a	O
lower	O
logical	O
level	O
,	O
mimicking	O
a	O
conventional	O
structured	B-Language
program	I-Language
structure	O
.	O
</s>
<s>
At	O
first	O
sight	O
,	O
the	O
use	O
of	O
control	B-Application
tables	I-Application
would	O
appear	O
to	O
add	O
quite	O
a	O
lot	O
to	O
a	O
program	O
's	O
overhead	O
,	O
requiring	O
,	O
as	O
it	O
does	O
,	O
an	O
interpreter	B-Application
process	O
before	O
the	O
'	O
native	O
 '	O
programming	O
language	B-Language
statements	O
are	O
executed	O
.	O
</s>
<s>
By	O
separating	O
(	O
or	O
'	O
encapsulating	O
 '	O
)	O
the	O
executable	O
coding	O
from	O
the	O
logic	O
,	O
as	O
expressed	O
in	O
the	O
table	B-Data_Structure
,	O
it	O
can	O
be	O
more	O
readily	O
targeted	O
to	O
perform	O
its	O
function	O
most	O
efficiently	O
.	O
</s>
<s>
This	O
may	O
be	O
experienced	O
most	O
obviously	O
in	O
a	O
spreadsheet	B-Application
application	O
–	O
where	O
the	O
underlying	O
spreadsheet	B-Application
software	I-Application
transparently	O
converts	O
complex	O
logical	O
'	O
formulae	O
 '	O
in	O
the	O
most	O
efficient	O
manner	O
it	O
is	O
able	O
,	O
in	O
order	O
to	O
display	O
its	O
results	O
.	O
</s>
<s>
The	O
examples	O
below	O
have	O
been	O
chosen	O
partly	O
to	O
illustrate	O
potential	O
performance	O
gains	O
that	O
may	O
not	O
only	O
compensate	O
significantly	O
for	O
the	O
additional	O
tier	O
of	O
abstraction	B-Application
,	O
but	O
also	O
improve	O
upon	O
–	O
what	O
otherwise	O
might	O
have	O
been	O
–	O
less	O
efficient	O
,	O
less	O
maintainable	O
and	O
lengthier	O
code	O
.	O
</s>
<s>
Although	O
the	O
examples	O
given	O
are	O
for	O
a	O
'	O
low	O
level	O
 '	O
assembly	B-Language
language	I-Language
and	O
for	O
the	O
C	B-Language
language	I-Language
,	O
it	O
can	O
be	O
seen	O
,	O
in	O
both	O
cases	O
,	O
that	O
very	O
few	O
lines	O
of	O
code	O
are	O
required	O
to	O
implement	O
the	O
control	B-Application
table	I-Application
approach	O
and	O
yet	O
can	O
achieve	O
very	O
significant	O
constant	O
time	O
performance	O
improvements	O
,	O
reduce	O
repetitive	O
source	O
coding	O
and	O
aid	O
clarity	O
,	O
as	O
compared	O
with	O
verbose	O
conventional	O
program	O
language	B-Language
constructs	O
.	O
</s>
<s>
See	O
also	O
the	O
quotations	O
by	O
Donald	O
Knuth	O
,	O
concerning	O
tables	O
and	O
the	O
efficiency	B-General_Concept
of	O
multiway	O
branching	O
in	O
this	O
article	O
.	O
</s>
<s>
It	O
should	O
be	O
clear	O
that	O
this	O
technique	O
can	O
easily	O
be	O
extended	O
to	O
deal	O
with	O
multiple	O
inputs	O
,	O
either	O
by	O
increasing	O
the	O
number	O
of	O
columns	O
or	O
utilizing	O
multiple	O
table	B-Data_Structure
entries	O
(	O
with	O
optional	O
and/or	O
operator	O
)	O
.	O
</s>
<s>
Similarly	O
,	O
by	O
using	O
(	O
hierarchical	O
)	O
'	O
linked	O
 '	O
control	B-Application
tables	I-Application
,	O
structured	B-Language
programming	I-Language
can	O
be	O
accomplished	O
(	O
optionally	O
using	O
indentation	O
to	O
help	O
highlight	O
subordinate	O
control	B-Application
tables	I-Application
)	O
.	O
</s>
<s>
"	O
CT1	O
"	O
is	O
an	O
example	O
of	O
a	O
control	B-Application
table	I-Application
that	O
is	O
a	O
simple	O
lookup	B-Data_Structure
table	I-Data_Structure
.	O
</s>
<s>
The	O
first	O
column	O
represents	O
the	O
input	O
value	O
to	O
be	O
tested	O
(	O
by	O
an	O
implied	O
'	O
IF	O
input1	O
=	O
x	O
 '	O
)	O
and	O
,	O
if	O
TRUE	O
,	O
the	O
corresponding	O
2nd	O
column	O
(	O
the	O
'	O
action	O
 '	O
)	O
contains	O
a	O
subroutine	O
address	O
to	O
perform	O
by	O
a	O
call	B-Operating_System
(	O
or	O
jump	B-General_Concept
to	O
–	O
similar	O
to	O
a	O
SWITCH	O
statement	O
)	O
.	O
</s>
<s>
For	O
programming	O
languages	O
that	O
support	O
pointers	O
within	O
data	B-General_Concept
structures	I-General_Concept
alongside	O
other	O
data	O
values	O
,	O
the	O
above	O
table	B-Data_Structure
(	O
CT1	O
)	O
can	O
be	O
used	O
to	O
direct	O
control	O
flow	O
to	O
an	O
appropriate	O
subroutines	O
according	O
to	O
matching	O
value	O
from	O
the	O
table	B-Data_Structure
(	O
without	O
a	O
column	O
to	O
indicate	O
otherwise	O
,	O
equality	O
is	O
assumed	O
in	O
this	O
simple	O
case	O
)	O
.	O
</s>
<s>
No	O
attempt	O
is	O
made	O
to	O
optimize	O
the	O
lookup	B-Data_Structure
in	O
coding	O
for	O
this	O
first	O
example	O
,	O
and	O
it	O
uses	O
instead	O
a	O
simple	O
linear	B-Algorithm
search	I-Algorithm
technique	O
–	O
purely	O
to	O
illustrate	O
the	O
concept	O
and	O
demonstrate	O
fewer	O
source	O
lines	O
.	O
</s>
<s>
To	O
handle	O
all	O
256	O
different	O
input	O
values	O
,	O
approximately	O
265	O
lines	O
of	O
source	O
code	O
would	O
be	O
required	O
(	O
mainly	O
single	O
line	O
table	B-Data_Structure
entries	O
)	O
whereas	O
multiple	O
'	O
compare	O
and	O
branch	O
 '	O
would	O
have	O
normally	O
required	O
around	O
512	O
source	O
lines	O
(	O
the	O
size	O
of	O
the	O
binary	O
is	O
also	O
approximately	O
halved	O
,	O
each	O
table	B-Data_Structure
entry	O
requiring	O
only	O
4	O
bytes	O
instead	O
of	O
approximately	O
8	O
bytes	O
for	O
a	O
series	O
of	O
'	O
compare	O
immediate'/branch	O
instructions	O
(	O
For	O
larger	O
input	O
variables	O
,	O
the	O
saving	O
is	O
even	O
greater	O
)	O
.	O
</s>
<s>
LM	O
R14	O
,	O
R0	O
,	O
=	O
A(4,CT1,N )	O
Set	O
R14	O
=	O
4	O
,	O
R15	O
-->	O
table	B-Data_Structure
,	O
and	O
R0	O
=	O
no	O
.	O
</s>
<s>
TRY	O
CLC	O
INPUT1	O
,	O
0(R15 )	O
*********	O
Found	O
value	O
in	O
table	B-Data_Structure
entry	O
?	O
</s>
<s>
DC	O
C	B-Language
 '	O
?	O
</s>
<s>
To	O
make	O
a	O
selection	O
in	O
the	O
example	O
above	O
,	O
the	O
average	O
instruction	B-General_Concept
path	I-General_Concept
length	I-General_Concept
(	O
excluding	O
the	O
subroutine	O
code	O
)	O
is	O
'	O
4n/2	O
+3	O
 '	O
,	O
but	O
can	O
easily	O
be	O
reduced	O
,	O
where	O
n	O
=	O
1	O
to	O
64	O
,	O
to	O
a	O
constant	O
time	O
with	O
a	O
path	O
length	O
of	O
'	O
5	O
 '	O
with	O
zero	O
comparisons	O
,	O
if	O
a	O
256	O
byte	O
translate	O
table	B-Data_Structure
is	O
first	O
utilized	O
to	O
create	O
a	O
direct	O
index	B-Data_Structure
to	O
CT1	O
from	O
the	O
raw	O
EBCDIC	B-Language
data	O
.	O
</s>
<s>
Where	O
n	O
=	O
6	O
,	O
this	O
would	O
then	O
be	O
equivalent	O
to	O
just	O
3	O
sequential	O
compare	O
&	O
branch	B-General_Concept
instructions	I-General_Concept
.	O
</s>
<s>
Where	O
n	O
=	O
1	O
to	O
256	O
,	O
on	O
average	O
it	O
would	O
use	O
approximately	O
42	O
times	O
less	O
instructions	O
–	O
since	O
,	O
in	O
this	O
case	O
,	O
one	O
additional	O
instruction	O
would	O
be	O
required	O
(	O
to	O
multiply	O
the	O
index	B-Data_Structure
by	O
4	O
)	O
.	O
</s>
<s>
Improved	O
interpreter	B-Application
(	O
up	O
to	O
26	O
times	O
less	O
executed	O
instructions	O
than	O
the	O
above	O
example	O
on	O
average	O
,	O
where	O
n	O
=	O
1	O
to	O
64	O
and	O
up	O
to	O
13	O
times	O
less	O
than	O
would	O
be	O
needed	O
using	O
multiple	O
comparisons	O
)	O
.	O
</s>
<s>
To	O
handle	O
64	O
different	O
input	O
values	O
,	O
approximately	O
85	O
lines	O
of	O
source	O
code	O
(	O
or	O
less	O
)	O
are	O
required	O
(	O
mainly	O
single	O
line	O
table	B-Data_Structure
entries	O
)	O
whereas	O
multiple	O
'	O
compare	O
and	O
branch	O
 '	O
would	O
require	O
around	O
128	O
lines	O
(	O
the	O
size	O
of	O
the	O
binary	O
is	O
also	O
almost	O
halved	O
–	O
despite	O
the	O
additional	O
256	O
byte	O
table	B-Data_Structure
required	O
to	O
extract	O
the	O
2nd	O
index	B-Data_Structure
)	O
.	O
</s>
<s>
FOUND	O
L	O
R15	O
,	O
CT1(R14 )	O
*********	O
get	O
pointer	O
to	O
subroutine	O
using	O
index	B-Data_Structure
(	O
0	O
,	O
4	O
,	O
8	O
etc	O
.	O
)	O
</s>
<s>
Further	O
improved	O
interpreter	B-Application
(	O
up	O
to	O
21	O
times	O
less	O
executed	O
instructions	O
(	O
where	O
n>	O
=	O
64	O
)	O
than	O
the	O
first	O
example	O
on	O
average	O
and	O
up	O
to	O
42	O
times	O
less	O
than	O
would	O
be	O
needed	O
using	O
multiple	O
comparisons	O
)	O
.	O
</s>
<s>
To	O
handle	O
256	O
different	O
input	O
values	O
,	O
approximately	O
280	O
lines	O
of	O
source	O
code	O
or	O
less	O
,	O
would	O
be	O
required	O
(	O
mainly	O
single	O
line	O
table	B-Data_Structure
entries	O
)	O
,	O
whereas	O
multiple	O
'	O
compare	O
and	O
branch	O
 '	O
would	O
require	O
around	O
512	O
lines	O
(	O
the	O
size	O
of	O
the	O
binary	O
is	O
also	O
almost	O
halved	O
once	O
more	O
)	O
.	O
</s>
<s>
FOUND	O
L	O
R15	O
,	O
CT1(R14 )	O
*********	O
get	O
pointer	O
to	O
subroutine	O
using	O
index	B-Data_Structure
(	O
0	O
,	O
4	O
,	O
8	O
etc	O
.	O
)	O
</s>
<s>
This	O
example	O
in	O
C	B-Language
uses	O
two	O
tables	O
,	O
the	O
first	O
(	O
CT1	O
)	O
is	O
a	O
simple	O
linear	B-Algorithm
search	I-Algorithm
one-dimensional	O
lookup	B-Data_Structure
table	I-Data_Structure
–	O
to	O
obtain	O
an	O
index	B-Data_Structure
by	O
matching	O
the	O
input	O
(	O
x	O
)	O
,	O
and	O
the	O
second	O
,	O
associated	O
table	B-Data_Structure
(	O
CT1p	O
)	O
,	O
is	O
a	O
table	B-Data_Structure
of	O
addresses	O
of	O
labels	O
to	O
jump	B-General_Concept
to	O
.	O
</s>
<s>
This	O
can	O
be	O
made	O
more	O
efficient	O
if	O
a	O
256	O
byte	O
table	B-Data_Structure
is	O
used	O
to	O
translate	O
the	O
raw	O
ASCII	B-Protocol
value	I-Protocol
(	O
x	O
)	O
directly	O
to	O
a	O
dense	O
sequential	O
index	B-Data_Structure
value	O
for	O
use	O
in	O
directly	O
locating	O
the	O
branch	O
address	O
from	O
CT1p	O
(	O
i.e.	O
</s>
<s>
"	O
index	B-Data_Structure
mapping	I-Data_Structure
"	O
with	O
a	O
byte-wide	O
array	B-Data_Structure
)	O
.	O
</s>
<s>
It	O
will	O
then	O
execute	O
in	O
constant	O
time	O
for	O
all	O
possible	O
values	O
of	O
x	O
(	O
If	O
CT1p	O
contained	O
the	O
names	O
of	O
functions	O
instead	O
of	O
labels	O
,	O
the	O
jump	B-General_Concept
could	O
be	O
replaced	O
with	O
a	O
dynamic	O
function	O
call	B-Operating_System
,	O
eliminating	O
the	O
switch-like	O
goto	B-Application
–	O
but	O
decreasing	O
performance	O
by	O
the	O
additional	O
cost	O
of	O
function	O
housekeeping	B-General_Concept
)	O
.	O
</s>
<s>
The	O
next	O
example	O
below	O
illustrates	O
how	O
a	O
similar	O
effect	O
can	O
be	O
achieved	O
in	O
languages	O
that	O
do	O
not	O
support	O
pointer	O
definitions	O
in	O
data	B-General_Concept
structures	I-General_Concept
but	O
do	O
support	O
indexed	O
branching	O
to	O
a	O
subroutine	O
–	O
contained	O
within	O
a	O
(	O
0-based	O
)	O
array	B-Data_Structure
of	O
subroutine	B-Language
pointers	I-Language
.	O
</s>
<s>
The	O
table	B-Data_Structure
(	O
CT2	O
)	O
is	O
used	O
to	O
extract	O
the	O
index	B-Data_Structure
(	O
from	O
2nd	O
column	O
)	O
to	O
the	O
pointer	O
array	B-Data_Structure
(	O
CT2P	O
)	O
.	O
</s>
<s>
:	O
case0	O
,	O
case1	O
,	O
case2	O
,	O
case3	O
,	O
case4	O
)	O
which	O
then	O
either	O
process	O
the	O
input	O
directly	O
,	O
or	O
else	O
perform	O
a	O
call	B-Operating_System
(	O
with	O
return	O
)	O
to	O
the	O
appropriate	O
subroutine	O
(	O
default	O
,	O
Add	O
,	O
Subtract	O
,	O
Multiply	O
or	O
Divide	O
,..	O
)	O
to	O
deal	O
with	O
it	O
.	O
</s>
<s>
As	O
in	O
above	O
examples	O
,	O
it	O
is	O
possible	O
to	O
very	O
efficiently	O
translate	O
the	O
potential	O
ASCII	B-Protocol
input	O
values	O
(	O
A	O
,	O
S	O
,	O
M	O
,	O
D	O
or	O
unknown	O
)	O
into	O
a	O
pointer	O
array	B-Data_Structure
index	B-Data_Structure
without	O
actually	O
using	O
a	O
table	B-Data_Structure
lookup	I-Data_Structure
,	O
but	O
is	O
shown	O
here	O
as	O
a	O
table	B-Data_Structure
for	O
consistency	O
with	O
the	O
first	O
example	O
.	O
</s>
<s>
pointer	O
array	B-Data_Structure
!	O
</s>
<s>
Multi-dimensional	O
control	B-Application
tables	I-Application
can	O
be	O
constructed	O
(	O
i.e.	O
</s>
<s>
An	O
'	O
action	O
 '	O
can	O
include	O
a	O
pointer	O
to	O
another	O
subordinate	O
control	B-Application
table	I-Application
.	O
</s>
<s>
An	O
extra	O
column	O
to	O
count	O
the	O
actual	O
run-time	B-Library
events	O
for	O
each	O
input	O
as	O
they	O
occur	O
is	O
also	O
included	O
.	O
</s>
<s>
The	O
control	B-Application
table	I-Application
entries	O
are	O
then	O
much	O
more	O
similar	O
to	O
conditional	B-Language
statements	O
in	O
procedural	B-Application
languages	I-Application
but	O
,	O
crucially	O
,	O
without	O
the	O
actual	O
(	O
language	B-Language
dependent	O
)	O
conditional	B-Language
statements	O
(	O
i.e.	O
</s>
<s>
instructions	O
)	O
being	O
present	O
(	O
the	O
generic	B-Language
code	O
is	O
physically	O
in	O
the	O
interpreter	B-Application
that	O
processes	O
the	O
table	B-Data_Structure
entries	O
,	O
not	O
in	O
the	O
table	B-Data_Structure
itself	O
–	O
which	O
simply	O
embodies	O
the	O
program	O
logic	O
via	O
its	O
structure	O
and	O
values	O
)	O
.	O
</s>
<s>
In	O
tables	O
such	O
as	O
these	O
,	O
where	O
a	O
series	O
of	O
similar	O
table	B-Data_Structure
entries	O
defines	O
the	O
entire	O
logic	O
,	O
a	O
table	B-Data_Structure
entry	O
number	O
or	O
pointer	O
may	O
effectively	O
take	O
the	O
place	O
of	O
a	O
program	B-General_Concept
counter	I-General_Concept
in	O
more	O
conventional	O
programs	O
and	O
may	O
be	O
reset	O
in	O
an	O
'	O
action	O
 '	O
,	O
also	O
specified	O
in	O
the	O
table	B-Data_Structure
entry	O
.	O
</s>
<s>
The	O
example	O
below	O
(	O
CT4	O
)	O
shows	O
how	O
extending	O
the	O
earlier	O
table	B-Data_Structure
,	O
to	O
include	O
a	O
'	O
next	O
 '	O
entry	O
(	O
and/or	O
including	O
an	O
'	O
alter	O
flow	O
 '	O
(	O
jump	B-General_Concept
)	O
subroutine	O
)	O
can	O
create	O
a	O
loop	O
(	O
This	O
example	O
is	O
actually	O
not	O
the	O
most	O
efficient	O
way	O
to	O
construct	O
such	O
a	O
control	B-Application
table	I-Application
but	O
,	O
by	O
demonstrating	O
a	O
gradual	O
'	O
evolution	O
 '	O
from	O
the	O
first	O
examples	O
above	O
,	O
shows	O
how	O
additional	O
columns	O
can	O
be	O
used	O
to	O
modify	O
behaviour	O
.	O
)	O
</s>
<s>
The	O
fifth	O
column	O
demonstrates	O
that	O
more	O
than	O
one	O
action	O
can	O
be	O
initiated	O
with	O
a	O
single	O
table	B-Data_Structure
entry	O
–	O
in	O
this	O
case	O
an	O
action	O
to	O
be	O
performed	O
after	O
the	O
normal	O
processing	O
of	O
each	O
entry	O
('-'	O
values	O
mean	O
'	O
no	O
conditions	O
 '	O
or	O
'	O
no	O
action	O
 '	O
)	O
.	O
</s>
<s>
Structured	B-Language
programming	I-Language
or	O
"	B-Language
Goto-less	I-Language
"	I-Language
code	I-Language
,	O
(	O
incorporating	O
the	O
equivalent	O
of	O
'	O
DO	O
WHILE	O
 '	O
or	O
'	O
for	B-Language
loop	I-Language
 '	O
constructs	O
)	O
,	O
can	O
also	O
be	O
accommodated	O
with	O
suitably	O
designed	O
and	O
'	O
indented	O
 '	O
control	B-Application
table	I-Application
structures	B-General_Concept
.	O
</s>
<s>
pointer	O
array	B-Data_Structure
!	O
</s>
<s>
In	O
the	O
specialist	O
field	O
of	O
telecommunications	O
rating	O
(	O
concerned	O
with	O
the	O
determining	O
the	O
cost	O
of	O
a	O
particular	O
call	B-Operating_System
)	O
,	O
</s>
<s>
table-driven	O
rating	O
techniques	O
illustrate	O
the	O
use	O
of	O
control	B-Application
tables	I-Application
in	O
applications	O
where	O
the	O
rules	O
may	O
change	O
frequently	O
because	O
of	O
market	O
forces	O
.	O
</s>
<s>
If	O
the	O
algorithms	O
are	O
not	O
pre-built	O
into	O
the	O
interpreter	B-Application
(	O
and	O
therefore	O
require	O
additional	O
runtime	B-Library
interpretation	O
of	O
an	O
expression	O
held	O
in	O
the	O
table	B-Data_Structure
)	O
,	O
it	O
is	O
known	O
as	O
"	O
Rule-based	O
Rating	O
"	O
rather	O
than	O
table-driven	O
rating	O
(	O
and	O
consequently	O
consumes	O
significantly	O
more	O
overhead	O
)	O
.	O
</s>
<s>
A	O
spreadsheet	B-Application
data	O
sheet	O
can	O
be	O
thought	O
of	O
as	O
a	O
two	O
dimensional	O
control	B-Application
table	I-Application
,	O
with	O
the	O
non	O
empty	O
cells	O
representing	O
data	O
to	O
the	O
underlying	O
spreadsheet	B-Application
program	I-Application
(	O
the	O
interpreter	B-Application
)	O
.	O
</s>
<s>
The	O
cells	O
containing	O
formula	O
are	O
usually	O
prefixed	O
with	O
an	O
equals	O
sign	O
and	O
simply	O
designate	O
a	O
special	O
type	O
of	O
data	O
input	O
that	O
dictates	O
the	O
processing	O
of	O
other	O
referenced	O
cells	O
–	O
by	O
altering	O
the	O
control	O
flow	O
within	O
the	O
interpreter	B-Application
.	O
</s>
<s>
It	O
is	O
the	O
externalization	O
of	O
formulae	O
from	O
the	O
underlying	O
interpreter	B-Application
that	O
clearly	O
identifies	O
both	O
spreadsheets	B-Application
,	O
and	O
the	O
above	O
cited	O
"	O
rule	O
based	O
rating	O
"	O
example	O
as	O
readily	O
identifiable	O
instances	O
of	O
the	O
use	O
of	O
control	B-Application
tables	I-Application
by	O
non	O
programmers	O
.	O
</s>
<s>
If	O
the	O
control	B-Application
tables	I-Application
technique	O
could	O
be	O
said	O
to	O
belong	O
to	O
any	O
particular	O
programming	O
paradigm	O
,	O
the	O
closest	O
analogy	O
might	O
be	O
Automata-based	B-Application
programming	I-Application
or	O
"	B-Language
reflective	I-Language
"	I-Language
(	O
a	O
form	O
of	O
metaprogramming	B-Application
–	O
since	O
the	O
table	B-Data_Structure
entries	O
could	O
be	O
said	O
to	O
'	O
modify	O
 '	O
the	O
behaviour	O
of	O
the	O
interpreter	B-Application
)	O
.	O
</s>
<s>
The	O
interpreter	B-Application
itself	O
however	O
,	O
and	O
the	O
subroutines	O
,	O
can	O
be	O
programmed	O
using	O
any	O
one	O
of	O
the	O
available	O
paradigms	O
or	O
even	O
a	O
mixture	O
.	O
</s>
<s>
The	O
table	B-Data_Structure
itself	O
can	O
be	O
essentially	O
a	O
collection	O
of	O
"	O
raw	O
data	O
"	O
values	O
that	O
do	O
not	O
even	O
need	O
to	O
be	O
compiled	O
and	O
could	O
be	O
read	O
in	O
from	O
an	O
external	O
source	O
(	O
except	O
in	O
specific	O
,	O
platform	B-Operating_System
dependent	I-Operating_System
,	O
implementations	O
using	O
memory	O
pointers	O
directly	O
for	O
greater	O
efficiency	B-General_Concept
)	O
.	O
</s>
<s>
A	O
multi-dimensional	O
control	B-Application
table	I-Application
has	O
some	O
conceptual	O
similarities	O
to	O
bytecode	O
operating	O
on	O
a	O
virtual	B-Architecture
machine	I-Architecture
,	O
in	O
that	O
a	O
platform	B-Operating_System
dependent	I-Operating_System
"	B-Application
interpreter	I-Application
"	I-Application
program	O
is	O
usually	O
required	O
to	O
perform	O
the	O
actual	O
execution	O
(	O
that	O
is	O
largely	O
conditionally	O
determined	O
by	O
the	O
tables	O
content	O
)	O
.	O
</s>
<s>
There	O
are	O
also	O
some	O
conceptual	O
similarities	O
to	O
the	O
recent	O
Common	O
Intermediate	O
Language	B-Language
(	O
CIL	O
)	O
in	O
the	O
aim	O
of	O
creating	O
a	O
common	O
intermediate	O
'	O
instruction	O
set	O
 '	O
that	O
is	O
independent	O
of	O
platform	B-Device
(	O
but	O
unlike	O
CIL	O
,	O
no	O
pretensions	O
to	O
be	O
used	O
as	O
a	O
common	O
resource	O
for	O
other	O
languages	O
)	O
.	O
</s>
<s>
P-code	B-Language
can	O
also	O
be	O
considered	O
a	O
similar	O
but	O
earlier	O
implementation	O
with	O
origins	O
as	O
far	O
back	O
as	O
1966	O
.	O
</s>
<s>
When	O
a	O
multi-dimensional	O
control	B-Application
table	I-Application
is	O
used	O
to	O
determine	O
program	O
flow	O
,	O
the	O
normal	O
"	O
hardware	O
"	O
Program	B-General_Concept
Counter	I-General_Concept
function	O
is	O
effectively	O
simulated	O
with	O
either	O
a	O
pointer	O
to	O
the	O
first	O
(	O
or	O
next	O
)	O
table	B-Data_Structure
entry	O
or	O
else	O
an	O
index	B-Data_Structure
to	O
it	O
.	O
</s>
<s>
"	O
Fetching	O
"	O
the	O
instruction	O
involves	O
decoding	O
the	O
data	O
in	O
that	O
table	B-Data_Structure
entry	O
–	O
without	O
necessarily	O
copying	O
all	O
or	O
some	O
of	O
the	O
data	O
within	O
the	O
entry	O
first	O
.	O
</s>
<s>
Programming	O
languages	O
that	O
are	O
able	O
to	O
use	O
pointers	O
have	O
the	O
dual	O
advantage	O
that	O
less	O
overhead	O
is	O
involved	O
,	O
both	O
in	O
accessing	O
the	O
contents	O
and	O
also	O
advancing	O
the	O
counter	O
to	O
point	O
to	O
the	O
next	O
table	B-Data_Structure
entry	O
after	O
execution	O
.	O
</s>
<s>
table	B-Data_Structure
entry	O
)	O
can	O
even	O
be	O
performed	O
as	O
an	O
optional	O
additional	O
action	O
of	O
every	O
individual	O
table	B-Data_Structure
entry	O
allowing	O
loops	O
and	O
or	O
jump	B-General_Concept
instructions	O
at	O
any	O
stage	O
.	O
</s>
<s>
The	O
interpreter	B-Application
program	O
can	O
optionally	O
save	O
the	O
program	B-General_Concept
counter	I-General_Concept
(	O
and	O
other	O
relevant	O
details	O
depending	O
upon	O
instruction	O
type	O
)	O
at	O
each	O
stage	O
to	O
record	O
a	O
full	O
or	O
partial	O
trace	O
of	O
the	O
actual	O
program	O
flow	O
for	O
debugging	O
purposes	O
,	O
hot	O
spot	O
detection	O
,	O
code	B-Application
coverage	I-Application
analysis	O
and	O
performance	O
analysis	O
(	O
see	O
examples	O
CT3	O
&	O
CT4	O
above	O
)	O
.	O
</s>
<s>
code	O
re-use	O
–	O
the	O
"	B-Application
interpreter	I-Application
"	I-Application
is	O
usually	O
reusable	O
.	O
</s>
<s>
Frequently	O
it	O
can	O
be	O
easily	O
adapted	O
to	O
new	O
programming	O
tasks	O
using	O
precisely	O
the	O
same	O
technique	O
and	O
can	O
grow	O
'	O
organically	O
 '	O
becoming	O
,	O
in	O
effect	O
,	O
a	O
standard	B-Library
library	I-Library
of	O
tried	O
and	O
tested	O
subroutines	O
,	O
controlled	O
by	O
the	O
table	B-Data_Structure
definitions	O
.	O
</s>
<s>
efficiency	B-General_Concept
–	O
systemwide	O
optimization	O
possible	O
.	O
</s>
<s>
Any	O
performance	O
improvement	O
to	O
the	O
interpreter	B-Application
usually	O
improves	O
all	O
applications	O
using	O
it	O
(	O
see	O
examples	O
in	O
'	O
CT1	O
 '	O
above	O
)	O
.	O
</s>
<s>
the	O
interpreter	B-Application
can	O
be	O
introspective	B-Application
and	O
"	O
self	O
optimize	O
"	O
using	O
runtime	B-Library
metrics	O
collected	O
within	O
the	O
table	B-Data_Structure
itself	O
(	O
see	O
CT3	O
and	O
CT4	O
–	O
with	O
entries	O
that	O
could	O
be	O
periodically	O
sorted	O
by	O
descending	O
count	O
)	O
.	O
</s>
<s>
The	O
interpreter	B-Application
can	O
also	O
optionally	O
choose	O
the	O
most	O
efficient	O
lookup	B-Data_Structure
technique	O
dynamically	O
from	O
metrics	O
gathered	O
at	O
run-time	B-Library
(	O
e.g.	O
</s>
<s>
In-table	O
memoization	O
can	O
be	O
employed	O
to	O
achieve	O
this	O
.	O
</s>
<s>
control	B-Application
tables	I-Application
can	O
be	O
built	O
'	O
on-the-fly	O
'	O
(	O
according	O
to	O
some	O
user	O
input	O
or	O
from	O
parameters	O
)	O
and	O
then	O
executed	O
by	O
the	O
interpreter	B-Application
(	O
without	O
building	O
code	O
literally	O
)	O
.	O
</s>
<s>
(	O
these	O
'	O
intermediate	O
values	O
 '	O
can	O
however	O
be	O
calculated	O
beforehand	O
instead	O
within	O
a	O
subroutine	O
and	O
their	O
values	O
referred	O
to	O
in	O
the	O
conditional	B-Language
table	B-Data_Structure
entries	O
.	O
</s>
<s>
Alternatively	O
,	O
a	O
subroutine	O
can	O
perform	O
the	O
complete	O
complex	O
conditional	B-Language
test	O
(	O
as	O
an	O
unconditional	O
'	O
action	O
 '	O
)	O
and	O
,	O
by	O
setting	O
a	O
truth	O
flag	O
as	O
its	O
result	O
,	O
it	O
can	O
then	O
be	O
tested	O
in	O
the	O
next	O
table	B-Data_Structure
entry	O
.	O
</s>
