Category:XPL0
This programming language may be used to instruct a computer to perform a task.
See Also: 


If you know XPL0, please write code for some of the tasks not implemented in XPL0.
XPL0 is essentially a cross between Pascal and C. It looks somewhat like Pascal but works more like C. It was originally created in 1976 by Peter J. R. Boyle, who designed it to run on a 6502 microprocessor as an alternative to BASIC, which was the dominant language for personal computers at the time. XPL0 is based on PL/0, an example compiler in the book Algorithms + Data Structures = Programs by Niklaus Wirth. The first XPL0 compiler was written in ALGOL, which was then used to create a compiler written in XPL0's syntax.
XPL0 has been implemented on more than a dozen processors, but it's currently maintained for IBMtype PCs. Programs run under DOS and under versions of Windows that can still run DOS apps. Free, opensource versions of the compilers (interpreted, assemblycode compiled, and optimizing) are available from the official website: xpl0.org [1]. The 32bit version of the compiler, XPLPX, was used for all these Rosetta Code tasks.
Here's how the traditional Hello World program is coded:
code Text=12; Text(0, "Hello World!")
Text is a builtin routine, called an intrinsic, that outputs a string of characters. The zero (0) tells where to send the string. In this case it is sent to the display screen; but it could just as easily be sent to a printer, a file, or out a serial port by using a different number.
All names must be declared before they can be used. The command word code associates the name Text to the builtin routine number 12, which outputs strings. There are about 80 of these builtin routines that provide capabilities such as input and output, graphics, and trig functions.
Pages in category "XPL0"
The following 304 pages are in this category, out of 304 total.
2
A
 A+B
 Ackermann function
 Address of a variable
 Animate a pendulum
 Animation
 Anonymous recursion
 Arithmeticgeometric mean
 Arithmetic/Complex
 Arithmetic/Integer
 Arrays
 Assertions
 Associative array/Creation
 Associative array/Iteration
 Averages/Arithmetic mean
 Averages/Mean angle
 Averages/Mean time of day
 Averages/Pythagorean means
 Averages/Root mean square
B
C
 Caesar cipher
 Calendar
 Casesensitivity of identifiers
 Catalan numbers
 Character codes
 Check Machinlike formulas
 Closestpair problem
 Color of a screen pixel
 Colour bars/Display
 Colour pinstripe/Display
 Combinations
 Combinations with repetitions
 Comma quibbling
 Comments
 Compiletime calculation
 Conditional structures
 Constrained random points on a circle
 Continued fraction
 Continued fraction/Arithmetic/Construct from rational number
 Conway's Game of Life
 Copy a string
 Count in factors
 Count in octal
 Count occurrences of a substring
 CRC32
 Create a twodimensional array at runtime
 Cumulative standard deviation
D
E
F
G
H
 Hailstone sequence
 Happy numbers
 Harshad or Niven series
 Haversine formula
 Hello world/Line printer
 Hello world/Newline omission
 Hello world/Standard error
 Hello world/Text
 Here document
 Hofstadter Q sequence
 Honeycombs
 Horizontal sundial calculations
 Horner's rule for polynomial evaluation
 Host introspection
I
K
L
 Langton's ant
 Last Friday of each month
 Leap year
 Least common multiple
 Letter frequency
 Linear congruential generator
 Literals/Floating point
 Literals/Integer
 Literals/String
 Logical operations
 Long multiplication
 Loop over multiple arrays simultaneously
 Loops/Break
 Loops/Continue
 Loops/Dowhile
 Loops/Downward for
 Loops/For
 Loops/For with a specified step
 Loops/Foreach
 Loops/Infinite
 Loops/N plus one half
 Loops/Nested
 Loops/While
M
N
P
R
 Random number generator (device)
 Random number generator (included)
 Range expansion
 Rate counter
 Read a specific line from a file
 Read entire file
 Real constants and functions
 Remove duplicate elements
 Repeat a string
 Resistor mesh
 Return multiple values
 Reverse a string
 Roman numerals/Decode
 Rot13
 Runlength encoding
S
 Search a list
 Selfdescribing numbers
 Semordnilap
 Sequence of nonsquares
 Sierpinski carpet
 Sierpinski triangle
 Sierpinski triangle/Graphical
 Sieve of Eratosthenes
 Simple windowed application
 Singlylinked list/Element definition
 Singlylinked list/Traversal
 Solve the no connection puzzle
 Sort an array of composite structures
 Sort an integer array
 Sorting algorithms/Bead sort
 Sorting algorithms/Bogosort
 Sorting algorithms/Bubble sort
 Sorting algorithms/Cocktail sort
 Sorting algorithms/Counting sort
 Sorting algorithms/Gnome sort
 Sorting algorithms/Insertion sort
 Sorting algorithms/Merge sort
 Sorting algorithms/Quicksort
 Sorting algorithms/Selection sort
 Sorting algorithms/Shell sort
 Sorting algorithms/Stooge sort
 Soundex
 Spiral matrix
 Stack
 Stairclimbing puzzle
 String case
 String concatenation
 String length
 String matching
 Strip control codes and extended characters from a string
 Strip whitespace from a string/Top and tail
 Substring/Top and tail
 Sudoku
 Sum and product of an array
 Sum digits of an integer
 Sum multiples of 3 and 5
 Sum of a series
 Sum of squares
 System time
T
 Temperature conversion
 Terminal control/Clear the screen
 Terminal control/Coloured text
 Terminal control/Cursor movement
 Terminal control/Cursor positioning
 Terminal control/Dimensions
 Terminal control/Display an extended character
 Terminal control/Hiding the cursor
 Terminal control/Inverse video
 Terminal control/Positional read
 Terminal control/Preserve screen
 Terminal control/Ringing the terminal bell
 Tictactoe
 Time a function
 Tokenize a string
 Topswops
 Towers of Hanoi
 Trabb Pardo–Knuth algorithm
 Trigonometric functions
 Truncatable primes