Pilot
Encyclopedia : P : PI : PIL : Pilot
- For information on payments in lieu of taxes, see PILOT (finance).
Language syntax
A line of PILOT code contains (from left to right) the following syntax elements:
- an optional label
- a command letter
- an optional Y (for yes) or N (for no)
- an optional conditional expression in parentheses
- a colon (":")
- an operand, or multiple operands delimited by commas.
Command letters
The following commands are used in "core PILOT".
A:
Accept input into "accept buffer".
Examples:
A:
A:$FREE
A:$X,$Y,$Z
A:#Q
R:Next line of input replaces current contents of accept buffer
R:Next line of input replaces accept buffer, and string variable 'FREE'
R:Next 3 lines of input assigned to string variables 'X', 'Y' and 'Z'
R:Numeric input assigned to numeric variable "Q"
C:
Compute and assign numeric value.
Example:
C:#AM=(#X+#Y)/2
R:Assign arithmetic mean of #X and #Y to #AM
Most PILOT implementations have only integer arithmetic, and no arrays.
D:
Dimension an array, on some implementations.
E:
End (return from) subroutine or (if outside of a subroutine) abort program. Always used without any operand.
J:
Jump to label.
Example:
J:*RESTART
M:
Match the accept buffer against string variables or string literals.
Example:
M:TRUTH,$MEXICO,YOUTH
R:Search accept buffer for "TRUTH", the value of $MEXICO and "YOUTH", in that order
The first match string (if any) that is a substring of the accept buffer is assigned to the special variable $MATCH. The buffer characters left of the first match are assigned to $LEFT, and the characters on the right are assigned to $RIGHT.
The match flag is set to 'yes' or 'no', depending on whether a match is made. Any statement that has a Y following the command letter is processed only if the match flag is set. Statements with N are processed only if the flag is not set.
N:
Equivalent to TN: (type if last match unsuccessful)
R:
The operand of R: is a comment, and therefore not processed.
T:
'Type' operand as output.
Examples:
T:Thank you for your support.
T:Thank you, $NAME.
R:Output a literal string
R:Output a variable expression
U:
Use (call) a subroutine. A subroutine starts with a label and ends with E:
Example:
U:*INITIALIZE
R:Call subroutine starting at label *INITIALIZE
Y:
Equivalent to TY: (type if last match successful)
Parentheses:
If there is parenthesized expression in a statement, it is a test expression, and the statement is processed only if the test has a value of 'true'.
Example:
T(#X>#Y+#Z):Condition met
R:Type message if x>y+z
Extension features
Extensions to core pilot include arrays and floating point numbers in Apple PILOT, and implementation of LOGO-inspired turtle graphics in Atari PILOT.
Derivatives
Versions of PILOT overlaid on the BASIC interpreters of early microcomputers were not unknown in the late 1970s and early 1980s, and Byte Magazine at one point published a non-Turing complete derivative of PILOT known as Waduzitdo as a way of demonstrating what a computer was capable of.
From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.
