Professional Documents
Culture Documents
July 7, 1980
Peter Haynes
APL-11/V2.0
OF
ITS
Page 1
Operand Parameter Variables
___________________________.
Values
Description
Source Monadic
Right
Left
Result
C B I F
____________________________________________________________________
Type
A.BITS MONTYP+ RARGTY* LARGTY* RESTYP#
0 2 4 6
Shift Count
SIZTAB
MONSFT+
RARGSF*
LARGSF*
RESSFT#
0 0 1 2/3
Length Count
LENTAB
MONLEN+
RARGLE*
LARGLE*
RESLEN#
1 1 2 4/8
Element Length
LENTAB
RARGFL*
LARGFL*
MONBLK+
RARGBL*
LARGBL*
RESULT
MONPTR+
RARGPT*
LARGPT*
RESPTR
RARGLN*
LARGLN*
Block Pointer
Value Pointer
A.PTR
Array Length
A.ALEN
1 1 2 4/8
Fetch Routine
MONCVT+
RARGCV
LARGCV
RESCVT#
MONVAL
AC1
RARGVA
AC2
LARGVA
AC1
RESVAL
AC0
Page 2
Variable
________________________________
Type
DIMTYP
Block Pointer
DIMBLK
Value Pointer
DIMPTR
Page 3
Primative functions operand conversion and fetch routines.
_________________________________________________________
Operation
Routine prefix
Pointer register
Result in
FDL
R2
AC1
FDR
R3
AC2
FM
R2
AC1
Store Result
SM, SD
R1
AC0
Compare arguments
CMP
LARGVA, RARGVA
AC1, AC2
Condition
Codes
FM.CC,
DOMER,
DOMER,
DOMER
DOMER,
FM.BB,
FM.IB,
FM.FB
DOMER,
FM.BI,
FM.II,
FM.FI
DOMER,
FM.BF,
FM.IF,
FM.FF
BMONCT::
.WORD
IMONCT::
.WORD
FMONCT::
.WORD
DOMER
BRARGC::
.WORD
IRARGC::
.WORD
FRARGC::
.WORD
FDL.CC, DOMER,
DOMER,
DOMER
BLARGC::
.WORD
ILARGC::
.WORD
FLARGC::
.WORD
NOTE:
Page 4
SM.CC,
SYSER,
SYSER,
SYSER
SD.CB,
SM.BB,
SM.IB,
SM.FB
SYSER,
SM.BI,
SM.II,
SM.FI
SYSER,
SM.BF,
SM.IF,
SM.FF
BRESCT::
.WORD
IRESCT::
.WORD
FRESCT::
.WORD
Note:
CMP.C,
CMP.B,
CMP.I,
CMP.F
CMP.C,
CMP.B,
CMP.I,
CMP..F
ECOMCT::
.WORD
Note:
Page 5
Operator Numbers
________________.
The two macros MOPINS and DOPINS setup various tables which
allow the primative function routines to be accessed. Each
primative function is identified by an Operator number. The
connection between the primative function's APL character
representation and the Operator number is established by the CHR
macro. What overlay a primative function routine is to reside in
is determined by the OVROP macro. Below is a list of the currently
assigned operator numbers and RSX overlay. The number preceeding
each function is its overlay number.
Monadic function
0
0
0
0
0
0
0
1
1
Identity
Negation
Signum
Reciprocal
Absolute value
Floor
Ceiling
Exponential
Factorial
0
0
1
0
8
8
Not
PI times
Natural logarithm
Ravel
Reduction
Scan
0
0
0
4
Execute
Index generator
Quad output
Quote
Number
2
4
6
10
12
14
16
20
22
24
26
30
32
34
36
40
42
44
46
50
52
54
56
60
62
64
66
70
72
74
76
Dyadic function
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
5
1
1
0
1
2
2
5
2
2
0
2
Addition
Subtraction
Multiplication
Division
Residue
Minimum
Maximum
Power
Combinations
Less than
Less than or equal
Equal
Greater than
Not equal
Greater than or equal
Or
And
Nor
Nand
Set difference
Circle functions
Logarithm
Catenate/Laminate
Compression
Expansion
Decode
Intersection
Membership
Index of
Quad input
Encode
Page 6
Monadic function
0
0
Roll
Shape
Nub
7
8
9
8
3
5
3
3
0
3
3
Matrix inverse
First coordinate Reduction
Transpose
First coordinate Scan
I beam
Del quad
Grade down
Grade up
Quote quad input
Reverse
First coordinate Reverse
9
4
6
6
6
6
6
6
6
6
6
6
6
6
6
6
Outer product
Format
Quad AV
Quad CT input
Quad IO input
Quad PP input
Quad PW input
Quad RL input
Quad WA
Quad TS
Quad EX
Quad NC
Quad CR
Quad FX
Qual NC
Quad NL input
Scientific subroutines
Number
100
102
104
106
110
112
114
116
120
122
124
126
130
132
134
136
140
142
144
146
150
152
154
156
160
162
164
166
170
172
174
176
200
202
204
206
210
212
214
234
236
Dyadic function
3
0
2
5
0
5
2
5
0
7
1
4
2
2
0
3
3
5
5
5
10
4
Deal
Reshape
Drop
Union
Omega
Contains
Take
Subset (Diamond)
Right tack (Left tack)
Matrix divide
First coordinate Compress
Transpose
First coordinate Expand
I beam
6
6
6
6
6
Quad
Quad
Quad
Quad
Quad
CT
IO
PP
PW
RL
output
output
output
output
output
6
5
5
Quad NL output
Strict containment
Proper subset
Page 7
Data Structures
_______________.
There are three basic data structures which the APL interpreter
uses, the Symbol Table, the Free Storage List, and the SI Stack.
Symbol Table
____________
The Symbol table is used to hold all defined identifiers which
includes Variable names, Function names, Local variable names, and
Parameter names. The symbol table is organized as a 128 bucket hash
table. All entries within a bucket are chained by a singly linked
list and all the entries in the table are also chained in alphabetic
order by a singly linked list. This alphabetic list is used by the
)VARS command, etc. Besides the two links just described each symbol
entry contains a value pointer and the first 31 characters of the
symbol. Initially the symbol table contains 512 words of space and
additional space is obtained from Free storage as needed. Note, at
present symbol table space is never returned to the system once it is
obtained. Symbol table entries are always an even number of words
and a fill byte is used if required.
The alphabetic list is headed by a fake symbol entry containing
only a value pointer (which is unused) and an alphabetic link. The
alphabetic header is pointed to by SYMB1. SYMF points to the next
avaiable entry for entering a new symbol. A typical Symbol table
entry for "BA" is shown below. References to Symbol table entries
always point to the S.VAL word. The value of a Symbol table entry is
zero if the symbol is undefined.
S.CHR1=3, S.LEN=2
S.VAL=0
S.AB=-2
S.LINK=-4
^
|---------------|
!
| fill | "A" |
!
|---------------|
!
| "B" |
2
|
!
Hash
|---------------|
!
table ->|
Value
*----->
!
|---------------|
!
SYMB1 ->| Alpha Link *---------+
-2
|---------------|
|
Link
*--------+
|---------------|
!
!
V
Next symbol
in the alphabetic list
Next symbol
in the bucket
Page 8
Free Storage Organization.
_________________________
All of free storage, i.e. the user's workspace is allocated in
blocks of whole words. The storage management algorithm used is
First Fit with the search always starting at the beginning of free
storage. The first large enough block found is allocated. If it
is less than 8 words bigger than the requested block then the whole
free block is allocated, otherwise the free block is divided up and
the remainder is returned to the free storage list.
A free storage block may be one of four basic types; Function
Header, Function Line, List, or Data Array. The Function Header
type is really a variation of the Function Line type. Below is
pictured the general format of each type of block.
Function Header
Function Line
|---------------|
|
Tag
|
|---------------|
|
|
|
|
|
List
|
|
of
|
|
Locals*
|
|
|
|
|
|---------------|
| Right Argument|
|---------------|
| Left Argument |
|---------------|
|
Result
|
|---------------|
| Label List
|
|---------------|
|
Line
|
|
Number
|
|---------------|
|
Next Line
|
|---------------|
| Previous Line |
|---------------|
| Bits |#Locals|
|---------------|
| Function Name |
|---------------|
|
Tag
|
|---------------|
|---------------|
|
Tag
|
|---------------|
|
|
|
|
|
|
|
|
|
|
|
Code
|
|
|
|
String
|
|
|
|
|
|
|
|
|
|
|
|---------------|
| Label Block* |
|---------------|
|
Line
|
|
Number
|
|---------------|
|
Next Line
|
|---------------|
| Previous Line |
|---------------|
| Bits |#Labels|
|---------------|
| Code Offset |
|---------------|
|
Tag
|
|---------------|
* Optional
Page 9
List Block
|---------------|
|
Tag
|
|---------------|
|
|
|
|
|
List
|
|
of
|
|
Pointers
|
|
|
|
|
|---------------|
| Last Pointer |
|---------------|
| Bits | Count |
|---------------|
| First Pointer |
|---------------|
|
Tag
|
|---------------|
|---------------|
|
Tag
|
|---------------|
|
|
|
|
|
Data
|
|
|
|
Values
|
|
|
|
|
|---------------|
|
|
|
Dimensions |
|
|
|---------------|
| Array Length |
|---------------|
| Bits | Rank |
|---------------|
| Data Pointer |
|---------------|
|
Tag
|
|---------------|
Word
= 000000
S.FLB = 040000
S.ASB = 100000
Note:
In all diagrams Low core is shown at the bottom of the page
working up to High core at the top of the page. The following formats
are used to represent a word and byte of storage respectively.
|---------------|
|
|
|
|---------------|
|-------|
|
|
|-------|
Page 10
Data Array Blocks
_________________.
All APL variables are stored in array blocks whether they are
scalars or arrays. Below is given the form of some typical arrays
and some of the important special cases. References to Array blocks
always point to the A.PTR word. Note that A.PTR does not necessarily
point to the word immediately following the last dimension word
(see Ravel, for example.)
Tag
Scalar value
A.DIM1=6
First dimension
A.ALEN=4
Array length
A.BITS=3, A.DIMS=2
Type, Rank
A.PTR=0
Pointer to value
Tag
Description of A.BITS
_____________________
A.ASB = 200
A.TMP = 010
A.CON = 020
A.ARG = 040
.CHARACTER
.BOOLEAN
.INTEGER
.FLOAT
A.NUM = 006
=
=
=
=
000
002
004
006
Page 11
Vector (.io 5)
|
|
|
|
|
|
|---------------|
|
-6
<-+
|---------------| !
|
0
| !
|---------------| !
|
0
| !
|---------------| !
| 212 |
1
| !
|---------------| !
|
*---+
|---------------|
|
-6
|
|---------------|
|
|
|
|
|
|
|
|
|---------------|
|
-11
|
|---------------|
|
5
|
|
|
|
4
|
|
|
|
3
|
|
|
|
2
|
|
|
|
1
<-+
|---------------| !
|
5
| !
|---------------| !
|
5
| !
|---------------| !
| 214 |
1
| !
|---------------| !
|
*---+
|---------------|
|
-11
|
|---------------|
|
|
|
|
Tag
Data
values
A.DIM1
A.ALEN
A.BITS, A.DIMS
A.PTR
Tag
Page 12
Tag
Data
values
|
|
|
|
|
|
|---------------|
|
-7
<-+
|---------------| !
|
3
| !
|---------------| !
|
0
| !
|---------------| !
|
0
| !
|---------------| !
| 210 |
2
| !
|---------------| !
|
*---+
|---------------|
|
-7
|
|---------------|
|
|
|
|
Dimension 2
A.DIM1
A.ALEN
A.BITS, A.DIMS
A.PTR
Tag
|
|
|
|
|---------------|
|
-13
|
|---------------|
|
12
|
|
|
|
11
|
|
|
|
9
|
|
|
|
7
|
|
|
|
5
|
|
|
|
3
<-+
|---------------| !
|
3
| !
|---------------| !
|
2
| !
|---------------| !
|
6
| !
|---------------| !
| 214 |
2
| !
|---------------| !
|
*---+
|---------------|
|
-13
|
|---------------|
|
|
|
|
Page 13
|
|
|
|
|---------------|
|
-8
<-+
|---------------| !
|
4
| !
|---------------| !
|
0
| !
|---------------| !
|
2
| !
|---------------| !
|
0
| !
|---------------| !
| 214 |
3
| !
|---------------| !
|
*---+
|---------------|
|
-8
|
|---------------|
|
|
|
|
|
|
|
|
|---------------|
|
-88
|
|---------------|
|
|
|
|
|
Values
|
| (in Row
|
|
Major
|
|
Order) |
|
|
|
<-+
|---------------| !
|
5
| !
|---------------| !
|
2
| !
|---------------| !
|
4
| !
|---------------| !
|
40
| !
|---------------| !
| 216 |
3
| !
|---------------| !
|
*---+
|---------------|
|
-88
|
|---------------|
|
|
|
|
Tag
Dimension 3
Dimension 2
A.DIM1
A.ALEN
A.BITS, A.DIMS
A.PTR
Tag
Page 14
List Blocks
___________
List blocks are used to hold a list of pointers, which are used
for three purposes; Subscript lists, function Label lists, and Group
element list. When used for a Subscript list, the block contains one
pointer for each subscript in the list. The pointers point to Array
blocks which contain the values of the subscripts along each dimension.
A Null subscript is represented by a zero pointer. Note that the
pointers are stored in reverse order in the block.
When the List block is used for a function Label list, the pointers
point to the function Line blocks which have labels attached to them.
The Label list block is pointed to by the function Header block. The
Label list blocks do not use L.PTR1 or the empty slot, i.e. the thing
following the count/bits slot is a pointer to a function line block.
The Label pointers are stored in reverse order, i.e. the last one is
pointed to by L.PTR. Below is the general layout of a List block.
List blocks are referenced by pointing to L.PTR.
|---------------|
|
Tag
|
|---------------|
|
|
|
|
|
Pointers
<---+
|
|
!
|
|
!
|
|
!
|
Empty
<-+ !
|---------------| ! !
L.PTR1=4
|
*---+ !
|---------------|
!
L.BITS=3, L.CNT=2
| Bits | Count |
!
|---------------|
!
L.PTR=0
Ref ->|
*-----+
|---------------|
|
Tag
|
|---------------|
Note:
First pointer
Current last pointer
Last pointer
Number of pointers
In some cases the List block may not be full and the count
reflects the actual number of pointers. Initially there is
space for 5 pointers.
The Bits field is used to save the printing flag.
L.PRNT = 001
Page 15
Function Blocks
_______________.
Function blocks come in two variations, function Headers, function
Line blocks. The Header is a modification of the Line block to
accomudate storage for the function arguments and local variables.
The only tricky thing is the Line number field. When a function is
closed all the line numbers are simple integers, however when a
function is open it is possible for some line numbers to be floating
point numbers.
Hence space for a floating point number must be
reserved even though only an integer is stored. The detailed format
of the two types of function blocks is shown below.
Function Header Block
|---------------|
|
Tag
|
|---------------|
|
|
|
List
|
|
of
|
|
Locals
|
|
|
|---------------|
| Right argument|
|---------------|
| Left argument |
|---------------|
|
Result
|
|---------------|
| Label list *------>
|---------------|
|
Line
|
R.LNUM=10
|
Number
| ^
|---------------| !
R.NEXT=6
|
Next line *---+
|---------------|
R.PREV=4
|Previous line *---+
|---------------| !
R.BITS=3, R.LCT=2
| Bits |#Locals| V
|---------------|
R.PTR=0
Ref ->|Function name *------>
|---------------|
|
Tag
|
|---------------|
or Monadic argument
These are zero if
there are none
List block or zero
if there are none
Symbol table
Page 16
The bits field may have the following values.
always set.
F.FLB
S.FLB
Used only
F.RES
F.OPN
F.LOC
F.MON
F.NIL
Used only
F.LBL
F.TRC
F.STP
F.FLB is
= 100
Identifies block as a function block
= 040000 Word form of F.FLB
in header block
= 040
Returns a result
= 010
Open for editing
= 004
Locked
= 002
A Monadic function
= 001
A Niladic function
in non-header block
= 020
Line has a label
= 002
Trace this line
= 001
Stop at this line
Page 17
The State Indicator (SI) Stack
______________________________.
The SI stack is the main temporary storage area of the APL
interpreter. It is used for three basic types of storage. First
it stores the input string after it has been lexically analysized
and before parsing begins. Second it stores the execution time
information in the form of Parse, Function, and Execution frames.
And third it stores miscellaneous temporary information which some
routines use.
F.HEAD=4
F.LSTC=4
F.FLAG=2
F.PREV=0
SI.VAL=-2
SI.BIT=-4
SI.RET=-6
SI.LEN=-6
<----+
+---------------+
!
|
|
!
| Code string |
!
|
<--+ !
+---------------+ ! !
|
Return
| ! !
|---------------| ! !
| Token value | ! !
|---------------| ! !
| Token bits
| ! !
|---------------| ! !
| Input pointer | ! !
+---------------+ ! !
| Start of code*--+ !
|---------------|
!
| End of code *----+
|---------------|
|
Flags
|
|---------------|
Ref ->| Previous frame*---+
+---------------+
!
|
Value
|
!
|---------------|
!
|
Bits
|
!
|---------------|
!
|
Return
|
!
+---------------+
!
V
*
*
*
*
*
*
*
*
*
*
*
*
SP
R4
GETNXT pointers
R3
R2
Parse frame
Page 18
F.HEAD=6
F.LSTC=4
F.FLAG=2
F.PREV=0
F.VAL=-2
F.BITS=-4
F.RET=-6
<----+
+---------------+
!
|
|
!
| Code string |
!
|
<--+ !
+---------------+ ! !
|
E$CT
| ! !
|---------------| ! !
|
E$PT
| ! !
|---------------| ! !
|
INPTR
| ! !
+---------------+ ! !
|
Return
| ! !
|---------------| ! !
| Token value | ! !
|---------------| ! !
| Token bits
| ! !
|---------------| ! !
| Input pointer | ! !
+---------------+ ! !
| Start of code*--+ !
|---------------|
!
| End of code *----+
|---------------|
|
Flags
|
|---------------|
Ref ->| Previous frame*---+
+---------------+
!
|
Value
|
!
|---------------|
!
|
Bits
|
!
|---------------|
!
|
Return
|
!
+---------------+
!
V
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
Input pointers
SP
R4
GETNXT pointers
R3
R2
Parse frame
Page 19
F.STK
F.R4
F.R3
F.R2
F.LINE=12
F.FUN=10
F.HEAD=6
F.LSTC=4
F.FLAG=2
F.PREV=0
F.VAL=-2
F.BITS=-4
F.RET=-6
<----+
+---------------+
!
|
|
!
|
Labels
|
!
If any, in reverse
|
|
!
order
+---------------+
!
|
|
!
|
Locals
|
!
If any
|
<--+ !
+---------------+ ! !
| Right argument| ! !
or Monadic argument
|---------------| ! !
| Left argument | ! !
These are zero if
|---------------| ! !
there are none
|
Result
| ! !
+---------------+ ! !
|
Return
| ! !
* SP
|---------------| ! !
*
| Token value | ! !
* R4
|---------------| ! !
*
GETNEXT pointers
| Token bits
| ! !
* R3
|---------------| ! !
*
| Input pointer | ! !
* R2
+---------------+ ! !
| Current line *--+-+--> Current line block
|---------------| ! !
|
Header
*--+-+--> Function header block
|---------------| ! !
| Start of code*--+ !
|---------------|
!
| End of code *----+
|---------------|
|
Flags
|
|---------------|
Ref ->| Previous frame*---+
+---------------+
!
|
Value
|
!
*
|---------------|
!
*
|
Bits
|
!
* Parse frame
|---------------|
!
*
|
Return
|
!
*
+---------------+
!
V
Page 20
The Parse frame's Bits field may have the following values.
T.OPFN
T.SOP
T.NIL
T.MON
T.LIT
T.SPOP
T.DIM
T.TMP
=
=
=
=
=
=
=
=
000001
000002
000004
000010
000020
000040
000100
000200
T.LIST
T.VAR
T.NUM
T.CON
T.FUN
=
=
=
=
=
000400
001000
002000
004000
010000
The
The
The
The
The
The
The
The
value is
function
function
function
function
function
function
value is
The value is
The value is
The value is
The value is
The value is
pointer to a
T.BOL = 020000 The value is
T.OTHR = 040000 The value is
T.VAR = 100000 The value is
All bits describing functions are contained in the low byte which
corresponds to the BOPTAB table set up in APLOP.
The meaning of the bits in the Flags field of the various SI frames is
given in the following table.
F.SUSP
F.STOP
F.FNDF
F.BR
F.REDF
F$EVAL
F$EVI
F$EXEC
F$FUNC
F.END
=
=
=
=
=
=
=
=
=
=
000002
000004
000010
000020
000040
000100
000200
000400
001000
002000
Page 21
|
|
|
| <-- SI (R5)
|---------------|
|
Count
| <-- R2
|---------------|
|
|
|
|
|
Code
|
|
|
|
String
|
|
|
|
|
|---------------|
|
M.BOL
| <-- R0
|---------------|
|
|
|
|
Note:
The SI pointer is R5, and points to the location one beyond the
current frame. M.BOL is a special symbol used to mark the
beginning of the code string as the interpretor works down (from
the right end of the line) the stack. The Count is the number
of bytes in the code string including the M.BOL.
Most input characters (see the character table) are pushed straight
onto the SI stack from the line buffer by the lexical analysizer,
however the following characters get special handling. The C.SPLX mark
in VTAB indicates which characters.
Character
Carriage return
Quote (')
Lamp
Period (.)
Delta, A thru R,
U thru Z, Underscore
Delta, A thru Z
Minus, 0 thru 9
S, T
VTAB
Notes
0
2
4
6
10
End of line
Character literial
Comment
Dot, function or number
Identifier
12
14
Numeric literial
Stop and Trace, or identifier
Page 22
The table below lists the special characters that the lexical
analysizer inserts into the SI stack code string to mark special tokens
such as identifiers.
Character
Value
Description
M.FIL
177
M.BOL
200
M.SYN
201
M.CHR
202
M.SYM
203
M.NUM
204
Number, marks a dummy array block containing a numeric code string constant.
M.LIT
205
M.CMT
206
The following special actions take place when LEX encounters one
of these characters in the input string.
VTAB
Value
_____
0
Character
_________
Description
___________
Carriage
return
Quote (')
Array
block
Lamp
Page 23
This character signifies a character literial.
It causes LEX to create an Array block on the
SI stack which contains the literial, push a
pointer to the beginning of the Array block,
and then to push the byte M.LIT on the SI which
marks it as a literial constant. The final
form is:
|
|
|
|-------|
SI --> |
| M.LIT |
|---------------|
| (Offset)
*-------+
|---------------|
!
*
|
|
!
*
|
|
!
*
|
Character
|
!
*
|
|
!
*
|
String
|
!
*
|
|
!
*
|
<-+
!
*
|---------------| !
!
*
|
Dimension
| !
!
*
|---------------| !
!
*
| Array Length | !
!
*
|---------------| !
!
*
| Bits | Rank | !
!
*
|---------------| !
!
*
|
*---+ <-+
|---------------|
|
|
Bits=A.CON+
A.ASB
Rank=0 or 1
Period (.)
10
Delta,
A thru R,
U thru Z
Underscore
Delta,
A thru Z
Page 24
The Dot character may be part of either a number
or an operator (i.e. Inner or Outer product.)
If it is part of an operator then it is pushed
on the SI stack like any other character, and
processing continues as normal. However if it
is part of a number then control to goes to the
numeric literal handling routine. See VTAB
number 12 below.
These characters represent the possible initial
characters for any identifier (S and T are
also possible but are handled by the Stop/Trace
routine.) They cause LEX to collect the symbol,
enter it into the Symbol table if necessary,
and then push the Symbol table pointer followed
by M.SYM onto the SI stack. Note, symbols
include: Variable names, Function names, Local
variables, and Function parameters.
|
|
|
|-------|
|
| M.SYM |
|---------------|
|
Pointer
*-----> Symbol table
|---------------|
|
|
12
Minus,
0 thru 9
Array
block
*
*
*
*
*
*
*
*
*
*
*
*
*
*
|
|
|
|-------|
|
| M.NUM |
|---------------|
| (Offset)
*------+
|---------------|
!
|
|
!
|
|
!
|
Numeric
|
!
|
vector
|
!
|
|
!
|
<-+ !
|---------------| ! !
|
Dimension
| ! !
|---------------| ! !
| Array length | ! !
|---------------| ! !
| Bits | Rank | ! !
|---------------| ! !
|
*---+<-+
|---------------|
|
|
Bits=A.CON+A.ASB+
.BOOLEAN or
.INTEGER or
.FLOAT
Rank=0 or 1
Page 25
14
S or T
|
|
|
|-------|
|
| M.SYM |
|---------------|
| Pointer
*----> Symbol table
|---------------|
| Del | S or T|
|---------------|
|
|
Page 26
.DL Z _ F
[1]
; T
[2]
Z _ 0
L :
Z _ Z + A
[3]
T _ A % 2
[4]
.GO ( T < A _ A - 1 ) / L
.DL
A _ 10
F 5
Page 27
Page 28
SI Stack
________
Storage for
shadowed
variables
Token pointers
Function frame
Parse frame
for Result
|
|
+-->
|<-! +---------------+
! |
0
|
! |---------------|
! |
0
|
! |---------------|
! |
SYMTAB+24 *--->
! |---------------|
! |
0
|
! |---------------|
! |
0
|
! +---------------+
! |
WORKER+302 |
! |---------------|
! |
200
|
! |---------------|
! |
20000
|
! |---------------|
! |
*--->
! +---------------+
! |
*--->
! |---------------|
! |
*--->
! |---------------|
! |
0
|
! |---------------|
+---*
|
|---------------|
|
100000
|
|---------------|
+---*
|<-! +---------------+
! |
0
|
! |---------------|
! |
0
|
! |---------------|
! |
MONAD+102
|
! +---------------+
V |
|
s6
SI
Label L
Local T
a
Right argument A
Left argument (none)
Result Z
SP
R4
R3
s26
R2
l3
Current line
f0
Header
Unused
End of Locals
Flags=F.PRNT
SIFRAM
Previous frame
Value
Bits
Return
Page 29
s6
|
|
V
+---------------+
Parse frame !
|
*-----+
for
!
|---------------|
!
function
!
|
102000
|
!
argument
!
|---------------|
!
!
+->
EXEC+302
|
!
!
! +---------------+
!
!
! | M.FIL | M.NUM |
!
!
! +---------------+
!
!
! |
-12
|
!
!
! |---------------|
!
!
! |
5
<-+ !
Code
!
! |---------------| ! !
string
!
! |
1
| ! !
constant
!
! |---------------| ! !
!
! |
1
| ! !
!
! |---------------| ! !
!
! | 224 |
0
| ! !
!
! |---------------| ! !
!
! |
*--+<-+
!
! +---------------+
!
! | space | M.SYM |
!
! |---------------|
Code
!
! |
SYMTAB+14 *-->f
string
!
! |---------------|
!
! | M.FIL | space |
!
! |---------------|
!
! | space | space |
Execution
!
! |---------------|
frame
!
! | space | space |
!
! |---------------|
!
! | space | M.BOL <-+ <-- s26
!
! +---------------+ !
!
! |
0
| !
!
! |---------------| !
Token
!
! |
0
| !
pointers
!
! |---------------| !
!
! |
0
| !
!
! |---------------| !
!
! |
0
| !
!
! +---------------+ !
!
! |
*--+
!
! |---------------|
!
+-*
|
!
|---------------|
!
|
100100
|
!
|---------------|
+------->
0
|
+---------------+
Parse frame
|
0
|
for result
|---------------|
|
0
|
|---------------|
SISTAK --> |
0
|
+---------------+
Value
Bits=T.VAR+T.NUM
Return
Offset
Data
First dimension
Array length
Bits=A.ASB+A.CON+
.INTEGER, Rank
Pointer
SP
R4
R3
R2
Start of codestring
End of codestring
Flags=F$EVAL+F.PRNT
Previous frame
Value
Bits
Return
Page 30
Symbol Table
____________
SYMPT1 --> |
|
+---------------+
|
L
|
1
|
|---------------|
l --> +-----> VARBLE+132 *---->
!
|---------------|
!
+--*
|
!
! |---------------|
!
! |
0
|
!
! +---------------+
!
! |
T
|
1
|
!
! |---------------|
t --> !
+-> VARBLE+232 *---->
!
|---------------|
! +----*
|
! !
|---------------|
! !
|
0
|
! !
+---------------+
! !
|
A
|
1
|
! !
|---------------|
a ----+-+---> VARBLE+214 *---->
SYMB1
! !
|---------------|
! ! +--*
|
! ! ! |---------------|
! ! ! |
0
|
! ! ! +---------------+
! ! ! |
F
|
1
|
! ! ! |---------------|
f --> ! ! +->
VARBLE+2
*---->
! !
|---------------|
+-+----*
|
!
|---------------|
!
|
0
|
!
+---------------+
!
|
Z
|
1
|
!
|---------------|
z ----> +---> VARBLE+432 *---->
|---------------|
|
0
|
|---------------|
SYMTAB --> |
0
|
+---------------+
l1
t1
a1
f0
Symbol, Length
z1
Value
Alpha link
Hash link
Page 31
+---------------+
|
-1
|
+---------------+
|
7607
|
Free
|---------------|
|
|
Storage
|
|
|
|
Block
|
|
|---------------|
|
*--+
|---------------| !
ROVER --> |
*<-+
|---------------|
|
7607
|
+---------------+
|
-7
|
|---------------|
|
5
<-+
|---------------| !
Result Z
|
1
| !
|---------------| !
|
1
| !
|---------------| !
| 214 |
0
| !
|---------------| !
z1 --> |
*--+
|---------------|
|
-7
|
+---------------+
|
|
Bits=A.ASB+A.TMP+
.INTEGER, Rank
Page 32
|
|
+---------------+
|
-34
|
+---------------+
| M.FIL | M.SYM |
|---------------|
|
SYMTAB+44 *-->
|---------------|
| M.FIL |
/
|
|---------------|
|
)
| M.NUM |
+---------------+
|
-12
|
|---------------|
| FIL |
1
<-+
|---------------| !
|
1
| !
|---------------| !
|
1
| !
Code
|---------------| !
| 222 |
0
| !
String
|---------------| !
|
*--+
+---------------+
|
| M.SYM |
|---------------|
|
SYMTAB+24 *-->
|---------------|
|
<- | M.SYM |
|---------------|
|
SYMTAB+24 *-->
|---------------|
|
< | M.SYM |
|---------------|
|
SYMTAB+34 *-->
|---------------|
Function
| M.FIL |
(
|
|---------------|
Line
|
-> | M.BOL |
+---------------+
Block
|
|
|
|
|
|
|
4
|
|---------------|
|
*-->
|---------------|
|
*-->
|---------------|
|
0 |
0
|
|---------------|
l4 --> |
64
|
|---------------|
|
-34
|
+---------------+
|
|
Tag
*
*
*
*
*
*
*
*
*
*
*
Codestring constant
Bits=A.ASB+A.CON+
.BOOLEAN, Rank
Line number
f0
Next line
l3
Previous line
Bits, Number of
labels
Offset to codestring
Tag
Page 33
|
|
+---------------+
|
-26
|
+---------------+
| M.FIL | M.NUM |
+---------------+
|
-12
|
|---------------|
|
2
<-+
|---------------| !
|
1
| !
Code
|---------------| !
|
1
| !
String
|---------------| !
| 224 |
0
| !
|---------------| !
|
*--+
+---------------+
|
%
| M.SYM |
|---------------|
|
SYMTAB+24 *-->
|---------------|
|
<- | M.SYM |
|---------------|
|
SYMTAB+34 *-->
|---------------|
| M.FIL | M.BOL |
Function
+---------------+
|
|
Line
|
|
|
|
Block
|
3
|
|---------------|
|
*-->
|---------------|
|
*-->
|---------------|
|
0
|
0
|
|---------------|
l3 --> |
50
|
|---------------|
|
-26
|
+---------------+
|
|
Tag
*
*
*
*
*
*
*
*
*
*
*
Codestring constant
Bits=A.ASB+A.CON+
.INTEGER, Rank
Line number
l4
Next line
l2
Previous line
Bits, Number of
labels
Offset to codestring
Tag
|
|
+---------------+
|
-16
|
|---------------|
|
Unused
|
|
space
|
|---------------|
|
|
|
|
|
|
Local T
|
2.5
<-+
|---------------| !
|
1
| !
|---------------| !
|
1
| !
|---------------| !
| 216 |
0
| !
|---------------| !
t1 --> |
*--+
|---------------|
|
-16
|
+---------------+
|
-7
|
|---------------|
Right
|
5
<-+
argument A
|---------------| !
|
1
| !
|---------------| !
|
1
| !
|---------------| !
| 214 |
0
| !
|---------------| !
a1 --> |
*--+
|---------------|
|
-7
|
+---------------+
|
-7
|
|---------------|
|
12
<-+
Global A
|---------------| !
|
1
| !
|---------------| !
|
1
| !
|---------------| !
| 214 |
0
| !
|---------------| !
|
*--+
|---------------|
|
-7
|
+---------------+
|
-5
|
|---------------|
l2 <--*
<-+
Label
|---------------| !
|
0 |
1
| !
List
|---------------| !
l0 --> |
*--+
Block
|---------------|
|
-5
|
+---------------+
|
|
Page 34
Bits=A.ASB+A.TMP+
.FLOAT, Rank
Bits=A.ASB+A.TMP+
.INTEGER, Rank
Bits=A.ASB+A.TMP+
.INTEGER, Rank
Bits, Number of
labels
Page 35
|
|
+---------------+
|
-26
|
+---------------+
| M.FIL | M.SYM |
|---------------|
|
SYMTAB+24 *-->
|---------------|
Code
|
+
| M.SYM |
|---------------|
String
|
SYMTAB+4
*-->
|---------------|
|
<- | M.SYM |
|---------------|
|
SYMTAB+4
*-->
|---------------|
| M.FIL | M.BOL |
+---------------+
|
1
|
|---------------|
|
1
|
|---------------|
| 234 |
0
|
|---------------|
|
*--+
|---------------| !
l <--* SYMTAB+44
| !
+---------------+ !
|
| !
|
| !
Function
|
| !
|
2
<-+
Line
|---------------|
|
*-->
Block
|---------------|
|
*-->
|---------------|
|
0
|
1
|
|---------------|
l2 --> |
50
|
|---------------|
|
-26
|
+---------------+
|
|
Tag
*
*
*
*
*
*
*
*
*
Label block
Bits=A.ASB+A.CON+
A.TMP+.INTEGER,
Rank
Line number
l3
Next line
l1
Previous line
Bits, Number of
labels
Offset to codestring
Tag
Page 36
|
|
+---------------+
|
-24
|
+---------------+
| M.FIL | M.NUM |
+---------------+
|
-12
|
|---------------|
| FIL |
0
<-+
|---------------| !
Code
|
1
| !
|---------------| !
String
|
1
| !
|---------------| !
| 222 |
0
| !
|---------------| !
|
*--+
+---------------+
|
<- | M.SYM |
|---------------|
|
SYMTAB+4
*--> z
|---------------|
| M.FIL | M.BOL |
+---------------+
Function
|
|
|
|
Line
|
|
|
1
|
Block
|---------------|
|
*--> l2
|---------------|
|
*--> f0
|---------------|
|
0
|
0
|
|---------------|
l1 --> |
44
|
|---------------|
|
-24
|
+---------------+
|
|
Tag
*
*
*
*
*
*
*
*
*
*
*
Codestring constant
Bits=A.ASB+A.CON+
.BOOLEAN, Rank
Line number
Next line
Previous line
Bits, Number of
labels
Offset to codestring
Tag
Page 37
|
|
+---------------+
|
-17
|
|---------------|
|
SYMTAB+34 *-->
|---------------|
|
SYMTAB+24 *-->
|---------------|
|
0
|
|---------------|
Function
|
SYMTAB+4
*-->
|---------------|
Header
|
*-->
|---------------|
Block
|
|
|
|
|
|
|
0
|
|---------------|
|
*-->
|---------------|
|
*-->
|---------------|
| 142 |
1
|
|---------------|
f0 --> |
SYMTAB+14 *-->
|---------------|
VARBLE --> |
-17
|
+---------------+
|
-1
|
+---------------+
Tag
t
Locals
Right argument
Left argument
Result
l0
Label list
Line number
l1
Next line
l4
Previous line
Bits=F.FLB+F.RES+
F.MON, Number
of Locals
Name
Tag
End of free storage
Page 38
APL Characters.
______________
Octal
APL
TTY
0
1
2
3
4
5
6
7
10
11
12
Null
SOH
STX
Ctrl C
EOT
ENQ
ACK
Bell
Backspace
Tab
Line feed
NUL
SOH
STX
ETX
EOT
ENQ
ACK
BEL
BS
HT
LF
13
14
15
VT
VT
Form feed
FF
Carriage return CR
16
17
20
21
22
23
24
25
26
27
30
31
32
33
34
35
36
37
40
SO
SI
DLE
DC1
DC2
DC3
DC4
NAK
SYN
ETB
CAN
EM
Ctrl Z
Escape(Altmode)
FS
GS
RS
US
Space
41
42
43
44
45
46
47
Dieresis
.DD
)
)
<
<
Less than equal .LE
=
=
>
>
]
]
SO
SI
DLE
DC1
DC2
DC3
DC4
NAK
SYN
ETB
CAN
EM
SUB
ESC
FS
GS
RS
US
SP
CHRTAB
VTAB
C.SPGL
21
C.SPFX
C.SPFX
C.SPGL
C.SPGL
C.SPLX
C.SPRS
C>SPFX
C.SPGL
C.SPGL
C.SPGL
14
16
C.SPFX
C.SPRS
C.OP
C.OP
C.OP
C.OP
24
26
30
32
DYDTAB
24
26
30
32
MONTAB
APL
TTY
CHRTAB
VTAB
50
51
52
53
54
55
56
57
60
61
62
63
64
65
66
67
70
71
72
73
74
75
76
77
100
Or
And
Not equal
Division
,
+
.
/
0
1
2
3
4
5
6
7
8
9
(
[
;
Multiplication
:
\
Negation
.OR
&
.NE
%
,
+
.
/
0
1
2
3
4
5
6
7
8
9
(
[
;
#
:
\
.NG
C.OP
C.OP
C.OP
C.OP
C.OP
C.OP
C.SPLX
C.OP
C.TMP
C.TMP
C.TMP
C.TMP
C.TMP
C.TMP
C.TMP
C.TMP
C.TMP
C.TMP
40
42
34
10
56
2
6
60
12
12
12
12
12
12
12
12
12
12
40
42
34
10
56
2
156
60
10
56
2
156
60
C.OP
C.NUM
C.SPLX
62
12
62
62
101
102
103
104
105
106
107
110
Alpha
Decode
Intersection
Floor
Epsilon
_
Del
Delta
.AL
.DE
.DU
.FL
.EP
.US
.DL
.LD
C.OP
C.OP
C.OP
C.OP
C.IDEN
64
66
14
70
64
66
14
70
14
70
10
111
112
113
114
115
116
117
120
121
122
123
124
125
126
127
130
131
132
133
134
135
136
137
Iota
Jot
'
Quad
|
Encode
Circle
*
?
Rho
Ceiling
Not
Drop
Union
Omega
Strict contains
Take
Proper subset
Left arrow
Right tack
Right arrow
Greater equal
-
.IO
.SO
'
.BX
.AB
.EN
.LO
*
?
.RO
.CE
.NT
.DA
.UU
.OM
.LU
^
.RU
_
.RK
.GO
.GE
-
C.IDEN
C.SPLX
C.OP
C.OP
C.SPLX
C.OP
C.OP
C.OP
C.OP
C.OP
C.OP
C.OP
C.OP
C.OP
C.OP
C.OP
C.OP
C.OP
C.OP
C.OP
72
72
74
12
76
52
20
100
102
16
50
104
106
110
234
114
236
74
12
76
52
20
100
102
16
50
C.OP
C.OP
C.OP
C.OP
72
44
2
74
12
76
52
20
100
102
16
50
104
106
110
234
114
236
0
120
0
36
4
DYDTAB
Page 39
MONTAB
Octal
106
120
36
4
Page 40
Octal
APL
TTY
140
141
142
143
144
145
146
147
150
151
152
153
154
155
156
157
160
161
162
163
164
165
166
167
170
171
172
173
174
175
176
177
Diamond
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Left brace
Left tack
Right brace
$
M.FIL
.DM
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
.LB
.LK
.RB
$
200
M.BOL
201
M.SYN
202
M.CHR
203
M.SYM
204
M.NUM
205
M.LIT
206
M.CMT
207
210
211
212
213
CHRTAB
VTAB
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
116
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
14
14
10
10
10
10
10
10
120
C.SPRS
C.SPGL
C.SPRS
C.SPGL
C.SPRS
C.SPGL
C.SPRS
C.SPGL
C.SPRS
C.SPGL
C.SPRS
C.SPGL
C.SPRS
C.SPGL
C.SPRS
C.SPGL
4
6
10
16
14
12
20
DYDTAB
MONTAB
Page 41
Overstrikes
Octal
APL
TTY
CHRTAB
VTAB
214
215
216
217
220
221
222
223
224
225
226
227
230
231
232
233
234
235
236
237
240
241
242
243
244
245
246
247
250
251
252
253
254
255
256
257
260
261
262
263
264
265
266
267
270
271
272
273
274
275
276
277
Nor
.NR
Nand
.NN
Domino
.DQ
!
!
Column slash
.CS
Transpose
.TR
Column backslash.CB
I beam
.IB
Lamp
"
Underscore delta.Z@
Underscore A
.ZA
Underscore B
.ZB
Underscore C
.ZC
Underscore D
.ZD
Underscore E
.ZE
Underscore F
.ZF
Underscore G
.ZG
Underscore H
.ZH
Underscore I
.ZI
Underscore J
.ZJ
Underscore K
.ZK
Underscore L
.ZL
Underscore M
.ZM
Underscore N
.ZN
Underscore O
.ZO
Underscore P
.ZP
Underscore Q
.ZQ
Underscore R
.ZR
Underscore S
.ZS
Underscore T
.ZT
Underscore U
.ZU
Underscore V
.ZV
Underscore W
.ZW
Underscore X
.ZX
Underscore Y
.ZY
Underscore Z
.ZZ
Del quad
.QD
Grade down
.GD
Grade up
.GU
Quote quad
.QQ
Rotate
.RV
Logarithm
.LG
1st Coor. Rotate.CR
Input quad
.IQ
Output quad
.OQ
Protect Del
.PD
Execute
.XQ
O U T
.OU
File pointer
.PT
Thorn
.FM
Contains
.CO
Subset
.SS
C.OP
C.OP
C.OP
C.OP
C.OP
C.OP
C.OP
C.OP
C.SPLX
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.$
C.OP
C.OP
C.OP
C.OP
C.OP
C.OP
C.OP
C.OP
C.OP
44
46
122
22
124
126
130
132
4
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
134
136
140
142
144
54
146
150
152
C.OP
C.OP
C.OP
C.OP
154
160
112
116
DYDTAB
44
46
122
22
124
126
130
132
144
54
146
160
112
116
MONTAB
122
22
124
126
130
132
134
136
140
142
144
54
146
150
152
154
160
Page 42
Octal
APL
Quad
Quad
Quad
Quad
Quad
Quad
Quad
Quad
Quad
Quad
Quad
Quad
Quad
Quad
TTY
AV
CT
IO
PP
PW
RL
WA
TS
EX
NC
CR
FX
LC
NL
.BXAV
.BXCT
.BXIO
.BXPP
.BXPW
.BXRL
.BXWA
.BXTS
.BXEX
.BXNC
.BXCR
.BXFX
.BXLC
.BXNL
CHRTAB
VTAB
162
164
166
170
172
174
176
200
202
204
206
210
212
214
DYDTAB
164
166
170
172
174
214
MONTAB
162
164
166
170
172
174
176
200
202
204
206
210
212
214