Apple (programming language): Difference between revisions
Peter Flass (talk | contribs) →Text replacement: typo |
unreliable Tags: Reverted Visual edit Mobile edit Mobile web edit |
||
Line 79: | Line 79: | ||
==External links== |
==External links== |
||
* |
*APL: a language for associative data handling in PL/I |
||
[[Category:PL/I programming language family]] |
[[Category:PL/I programming language family]] |
Revision as of 12:22, 8 July 2024
Apple is a PL/I dialect programming language created by General Motors Research Laboratories for their Control Data Corporation STAR-100 supercomputer.
Apple is a subset of full PL/I, but has been extended to integrate with the Associative Programming Language (APL - not to be confused with APL (programming language) )[1]: p.9 [2]: p.92
Associative programming features
Data types | ||
Entity | "The ENTITY attribute specifies a variable that may be manipulated by the INSERT, REMOVE, FIND, and FOR EACH statements."[1]: p.94 | |
Set | "The SET attribute defines the name of a data aggregate that represents an ordered set of entity variables."[1]: p.107 | |
File_Set | A File_Set is a SET that is contained in an external file. |
Statements | ||
Create | Create is a synonym for Allocate. It causes storage to be allocated for a based variable. A file or set where the data is to be allocated may be specified. | |
Delete | Delete is a synonym for Free. Delete frees a based variable and optionally removes it from all sets of which it is a member. | |
Find | Locate an entity that is a member of a set or container based on specified conditions. An optional ELSE clause is executed if no entities are found. | |
For Each | Heads a group of statements to be executed for all entities or sets matching a specified condition. | |
Insert | Insert an entity into a specified set. Optionally, the placement of the new entity relative to other elements of the set may be specified. | |
Let | Set a locator variable to reference a specified set. | |
Remove | Remove an entity from a set. |
Builtin functions | ||
ALL | performs various operations on all members of a set, depending on the context in which it appears. | |
APLESET | returns a value indicating whether or not a file-set has been created. | |
APLEVAR | returns a pointer to the entity containing the set specified by its argument, or NULL if the set is a file-set. | |
APLINDX | ||
APLNUMB | ||
APLOWNI | ||
APLOWRS | ||
APLSNAM | ||
APLTYPE |
Other features
An OFFSET
variable identifies the relative location of a based variable in the containing file. A DESCRIPTOR
variable resembles a pointer variable, but also contains the length of the associated based variable in addition to its address.
The LOCK
statement puts a program into "locked status", where all asynchronous events will be queued. A corresponding UNLOCK
statement puts the program in "unlocked status", capable of processing asynchronous events. All queued events will be processed.
Hardware access
The REGISTER
storage class and the INLINE
builtin subroutine allow access to STAR hardware features.
A scalar arithmetic variable can be declared REGISTER [register-specification]
. register-specification
can be an unsigned integer constant 0..255 to specify one of the computer's hardware registers. If it is omitted the compiler will assign a register.[citation needed]
The INLINE
builtin subroutine inserts an arbitrary machine-language instruction into the compiled code. Except for the function code (operation code) and subcode of the instructions all operands can be numeric constants, variables, or arithmetic constants.
Example:[1]: p.202
CALL INLINE("F8", 5, 0, SOURCE, 0, "20", 0, TARGET);
Text replacement
The LITERALLY
specification allows the programmer to specify replacement text to be substituted at compile time. The syntax is:
%DECLARE <identifier> LITERALLY [ (<parameter-list> ) ] <character-constant> ;
If <parameter-list> is not specified the compiler replaces all occurrences of <identifier> throughout the program with <character-constant>.If <paramter-list> is specified, the replacement character string is formed by replacing all occurrences of the parameter name with the corresponding argument.
Example:
%DECLARE BITS LITERALLY(A1,A2) 'A1*A2*64'; I = BITS(J,B);
will generate the statement:
I=J*8*64;
Omitted PL/I features
Some features of standard PL/I are not included in Apple. The most significant are:[1]
- The
CONTROLLED
andAREA
storage attributes are not supported.FILE
andFILESET
have many of the characteristics ofAREA
. - List-directed and data-directed input and output are not supported.
- Record input-output statements, including
READ
,WRITE
,REWRITE
,LOCATE
, andDELETE
.DELETE
is used as a synonym forFREE
when deletingENTITY
variables.
References
- ^ a b c d e Krull, Fred; Marcotty, Michael; Pickrtt, Mary; Thomas, James; Zeilinger, Ronald (1972). Apple Reference Manual (PDF). General Motors Research Laboratories. Retrieved June 29, 2024.
- ^ Bachman, Charles (January 2006). An interview with Charles W. Bachman. doi:10.1145/1141880.1141882. ISBN 978-1-4503-1771-9. Retrieved June 29, 2024 – via ACM Digital Library."George [Dodd] built a very attractive IDS like system, called 'Associative Programming Language' (APL) which was integrated with PL/1. General Motors used it extensively in the graphic design system for automotive development. IBM latter asked GM to give up the initials, APL, so they could use them with their, 'A Programming Language.'”
External links
- APL: a language for associative data handling in PL/I