Mercurial > repo
view src/ploki/doc/ploki-instr.txt @ 11559:467d5b4a5976 draft
<oerjan> revert
author | HackEso <hackeso@esolangs.org> |
---|---|
date | Tue, 15 May 2018 02:37:49 +0100 |
parents | ac0403686959 |
children |
line wrap: on
line source
%%% THE PLOKI LANGUAGE: INSTRUCTIONS %%% Execution starts at the first line of the program. Instructions are executed in the order they appear in the program. Executing end-of-file is equivalent to END 0, i.e. successful exit. There are the following instructions ([X] means X is optional): * LET [Variable] Expression Evaluates Expression and assigns the result to Variable (or \_ if Variable is omitted). * WUNT [Value] Expression Writes the result of Expression to Value (which must yield an IO handle) if specified; otherwise it writes to \AUSG (standard output). Sets \_. * IF Expression Jumps to the corresponding ELSE or FI instruction if Expression yields false. "Corresponding" means it skips intervening IF-FI groups. If no ELSE or FI can be found, jumps to the beginning of the program. * ELSE Jumps to the corresponding FI instruction if present or to the beginning of the program otherwise. * FI, END IF Serves as an end point for IF and ELSE jumps. Does nothing. * GOTO Expression Jumps to the next line whose dynamic label is equal to the result of Expression. Search wraps around at end-of-file. * GOFOR Expression Jumps to the previous line whose dynamic label is equal to the result of Expression. Search wraps around at beginning-of-file. * CLAUDS Expression Closes the IO handle returned by Expression. Sets \_. * SET [Value] Expression Writes the character represented by the number returned by Expression to the IO handle specified by Value (or \AUSG if Value is omitted). Sets \_. * #! A comment. The rest of the line is ignored. * REM A comment. The rest of the line is ignored. REM comments may be nested. * # Expression Calls the C function system(3) with the result of Expression, i.e. runs the local command line interpreter. Sets \_. * NEXT Label Jumps to Label, which must be a static label. * ANRUF Expression Calls the next instruction with the dynamic label specified by Expression, i.e. it remembers the instruction it came from. Search wraps around at end-of-file. Sets \_ on returning. * ABRUF Value Expression Calls the previous instruction with the dynamic label specified by Value, passing Expression as argument. Search wraps around at beginning-of-file. Sets \_ on returning. * KTHX Expression Returns Expression from the current call. Equivalent to END if not in a call. * LEET [Variable] Expression Similar to LET but the old value of Variable (if any) is restored at the following KTHX. * END Expression Exits the program with a status of Expression. If Expression is -1, exits with EXIT_FAILURE. * IACS Expression Throws Expression as an exception. * FLUSH Expression Forces a write of all buffered data for the IO handle returned by expression, which must be opened for writing. Sets \_. * RESET Expression Clears the end-of-file and error flags for the IO handle returned by Expression. * Label Expression Calls the instruction with the static label Label, setting \@ to Expression. Sets \_ on returning. * Expression Prints the result of Expression to \AUSG.