PILOT Language Reference

PILOT (Programmed Inquiry, Learning Or Teaching) is an educational language from the 1960s, popular on Atari computers. PBXA64 embeds PILOT blocks inside PowerBASIC functions using #PCODE / #ENDP directives.

V10 Feature: PILOT #PCODE blocks are fully lowered to working PowerBASIC code by the compiler. Multiple blocks are supported with block-scoped labels and variables. All PILOT variables are automatically declared as LOCAL for #DIM ALL compatibility.

Command Reference

CommandDescriptionExample
T:Type (print text)T: Hello, World!
A:Accept (read input)A: What is your name?
M:Match (pattern test)M: YES
Y:Yes branch (match success)Y: Correct!
N:No branch (match failure)N: Try again!
C:Compute (assignment)C: score = score + 1
J:Jump (goto label)J: *START
U:Use (conditional jump/text)U: score>=3: *WIN
E:End (exit PILOT block)E:
R:Remark (comment)R: This is a comment
S:Screen (no-op, accepted)S: DRAW 50
*LABELLabel (jump target)*START

PILOT Variables

VariableTypeDescription
$AStringInput from the last A: command
#ANumericNumeric value of the last A: input (via VAL)
$nameStringNamed string variable (e.g., $NAME)
#countNumericNamed numeric variable (e.g., #SCORE)

Pattern Matching

PatternMatch TypeExample
Exact textExact match after TRIM$/UCASE$M: YES matches "YES", " yes "
Y*Prefix matchM: Y* matches "YES", "YELLOW"
*INGSuffix matchM: *ING matches "RUNNING"
*ORL*Substring matchM: *ORL* matches "WORLD"
*Wildcard (any input)M: * matches anything
NumericExact number matchM: 42 matches #A = 42
#VARNumeric variable matchM: #EXPECTED matches #A = #EXPECTED
$VARString variable matchM: $ANSWER matches $A = $ANSWER

Example: Quiz Program

FUNCTION PBMAIN() AS LONG
    #PCODE
    C: score = 0
    *LOOP
    T: What is 5 + 3?
    A:
    M: 8
    Y: Correct! $score = $score + 1
    N: Wrong! The answer is 8.
    T: Play again? (YES/NO)
    A:
    M: Y*
    Y: *LOOP
    T: You got #score correct!
    E:
    #ENDP
    FUNCTION = 0
END FUNCTION

How PILOT Maps to PB

PILOTGenerated PowerBASIC
T: Hello $namePRINT "Hello "; name$
A:INPUT a$ : a# = VAL(a$)
M: YESmatch = (UCASE$(TRIM$(a$)) = "YES")
Y: *LABELIF match THEN GOTO LABEL
C: a = b + ca# = b# + c#
J: *LABELGOTO LABEL
U: x>=5: *WINIF x# >= 5 THEN GOTO WIN
E:GOTO EndOfPilotBlock
*LABELLABEL:
Multiple Blocks: Multiple #PCODE / #ENDP blocks can appear in a single PB function. Each block gets unique internal prefixes for labels and variables to prevent name collisions.