4215
|
1 %%% THE PLOKI LANGUAGE: INSTRUCTIONS %%%
|
|
2
|
|
3
|
|
4 Execution starts at the first line of the program. Instructions are executed
|
|
5 in the order they appear in the program. Executing end-of-file is equivalent
|
|
6 to END 0, i.e. successful exit.
|
|
7
|
|
8 There are the following instructions ([X] means X is optional):
|
|
9
|
|
10 * LET [Variable] Expression
|
|
11 Evaluates Expression and assigns the result to Variable (or \_ if
|
|
12 Variable is omitted).
|
|
13
|
|
14 * WUNT [Value] Expression
|
|
15 Writes the result of Expression to Value (which must yield an IO handle)
|
|
16 if specified; otherwise it writes to \AUSG (standard output). Sets \_.
|
|
17
|
|
18 * IF Expression
|
|
19 Jumps to the corresponding ELSE or FI instruction if Expression yields
|
|
20 false. "Corresponding" means it skips intervening IF-FI groups. If no
|
|
21 ELSE or FI can be found, jumps to the beginning of the program.
|
|
22
|
|
23 * ELSE
|
|
24 Jumps to the corresponding FI instruction if present or to the beginning
|
|
25 of the program otherwise.
|
|
26
|
|
27 * FI, END IF
|
|
28 Serves as an end point for IF and ELSE jumps. Does nothing.
|
|
29
|
|
30 * GOTO Expression
|
|
31 Jumps to the next line whose dynamic label is equal to the result of
|
|
32 Expression. Search wraps around at end-of-file.
|
|
33
|
|
34 * GOFOR Expression
|
|
35 Jumps to the previous line whose dynamic label is equal to the result of
|
|
36 Expression. Search wraps around at beginning-of-file.
|
|
37
|
|
38 * CLAUDS Expression
|
|
39 Closes the IO handle returned by Expression. Sets \_.
|
|
40
|
|
41 * SET [Value] Expression
|
|
42 Writes the character represented by the number returned by Expression to
|
|
43 the IO handle specified by Value (or \AUSG if Value is omitted). Sets
|
|
44 \_.
|
|
45
|
|
46 * #!
|
|
47 A comment. The rest of the line is ignored.
|
|
48
|
|
49 * REM
|
|
50 A comment. The rest of the line is ignored. REM comments may be nested.
|
|
51
|
|
52 * # Expression
|
|
53 Calls the C function system(3) with the result of Expression, i.e. runs
|
|
54 the local command line interpreter. Sets \_.
|
|
55
|
|
56 * NEXT Label
|
|
57 Jumps to Label, which must be a static label.
|
|
58
|
|
59 * ANRUF Expression
|
|
60 Calls the next instruction with the dynamic label specified by
|
|
61 Expression, i.e. it remembers the instruction it came from. Search wraps
|
|
62 around at end-of-file. Sets \_ on returning.
|
|
63
|
|
64 * ABRUF Value Expression
|
|
65 Calls the previous instruction with the dynamic label specified by
|
|
66 Value, passing Expression as argument. Search wraps around at
|
|
67 beginning-of-file. Sets \_ on returning.
|
|
68
|
|
69 * KTHX Expression
|
|
70 Returns Expression from the current call. Equivalent to END if not in a
|
|
71 call.
|
|
72
|
|
73 * LEET [Variable] Expression
|
|
74 Similar to LET but the old value of Variable (if any) is restored at the
|
|
75 following KTHX.
|
|
76
|
|
77 * END Expression
|
|
78 Exits the program with a status of Expression. If Expression is -1,
|
|
79 exits with EXIT_FAILURE.
|
|
80
|
|
81 * IACS Expression
|
|
82 Throws Expression as an exception.
|
|
83
|
|
84 * FLUSH Expression
|
|
85 Forces a write of all buffered data for the IO handle returned by
|
|
86 expression, which must be opened for writing. Sets \_.
|
|
87
|
|
88 * RESET Expression
|
|
89 Clears the end-of-file and error flags for the IO handle returned by
|
|
90 Expression.
|
|
91
|
|
92 * Label Expression
|
|
93 Calls the instruction with the static label Label, setting \@ to
|
|
94 Expression. Sets \_ on returning.
|
|
95
|
|
96 * Expression
|
|
97 Prints the result of Expression to \AUSG.
|