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 on the Raspberry Pi and IBMtype PCs. Programs run under Linux, Windows, and DOS. 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 DOS compiler, XPLPX, was used for most of these Rosetta Code tasks, but more recent tasks were implemented using the compilers for the Raspberry Pi.
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 over a hundred of these builtin routines that provide capabilities such as input and output, graphics, and trig functions.
The 32bit versions of the compilers (as opposed to the older, 16bit versions) automatically declare code declarations. Thus the above program can simply be written as:
Text(0, "Hello World!")
Pages in category "XPL0"
The following 489 pages are in this category, out of 489 total.
2
A
 A+B
 ABC problem
 ABC words
 Abundant odd numbers
 Abundant, deficient and perfect number classifications
 Ackermann function
 Additive primes
 Address of a variable
 Air mass
 Alternade words
 Amicable pairs
 Angle difference between two bearings
 Animate a pendulum
 Animation
 Anonymous recursion
 Antiprimes
 Append numbers at same position in strings
 Archimedean spiral
 Arithmeticgeometric mean
 Arithmetic/Complex
 Arithmetic/Integer
 Arrays
 Assertions
 Associative array/Creation
 Associative array/Iteration
 Audio alarm
 Averages/Arithmetic mean
 Averages/Mean angle
 Averages/Mean time of day
 Averages/Pythagorean means
 Averages/Root mean square
B
 Babbage problem
 Balanced brackets
 Barnsley fern
 Base 16 numbers needing a to f
 Best shuffle
 Binary digits
 Bioinformatics/base count
 Bitmap
 Bitmap/Bresenham's line algorithm
 Bitmap/Bézier curves/Cubic
 Bitmap/Bézier curves/Quadratic
 Bitmap/Flood fill
 Bitmap/Midpoint circle algorithm
 Bitmap/Read a PPM file
 Bitmap/Write a PPM file
 Bitwise operations
 Boolean values
 Brownian tree
C
 Caesar cipher
 Calculating the value of e
 Calendar
 Camel case and snake case
 Casesensitivity of identifiers
 Catalan numbers
 Changeable words
 Chaos game
 Character codes
 Check Machinlike formulas
 Circles of given radius through two points
 Circular primes
 Closestpair problem
 Code Golf: Code Golf
 Collect and sort square numbers in ascending order from three lists
 Color of a screen pixel
 Color wheel
 Colour bars/Display
 Colour pinstripe/Display
 Combinations
 Combinations with repetitions
 Comma quibbling
 Commandline arguments
 Comments
 Common list elements
 Compare length of two strings
 Compiletime calculation
 Composite numbers k with no single digit factors whose factors are all substrings of k
 Concatenate two primes is also prime
 Conditional structures
 Consecutive primes with ascending or descending differences
 Constrained random points on a circle
 Continued fraction
 Continued fraction/Arithmetic/Construct from rational number
 Conway's Game of Life
 Coprimes
 Copy a string
 Count how many vowels and consonants occur in a string
 Count in factors
 Count in octal
 Count occurrences of a substring
 CRC32
 Create a twodimensional array at runtime
 Cumulative standard deviation
 CUSIP
 Cyclops numbers
D
 Date format
 Day of the week
 Day of the week of Christmas and New Year
 Deal cards for FreeCell
 Detect division by zero
 Determine if a string has all the same characters
 Determine if a string has all unique characters
 Digit fifth powers
 Digital root
 Dinesman's multipledwelling problem
 Distinct power numbers
 Dot product
 Dragon curve
 Draw a cuboid
 Draw a pixel
 Draw a rotating cube
 Draw a sphere
 Draw pixel 2
E
F
 Factorial
 Factors of an integer
 Fibonacci nstep number sequences
 Fibonacci sequence
 File input/output
 Filter
 Find adjacent primes which differ by a square integer
 Find if a point is within a triangle
 Find minimum number of coins that make a given value
 Find prime n such that reversed n is also prime
 Find prime numbers of the form n*n*n+2
 Find square difference
 Find squares n where n+1 is prime
 Find the missing permutation
 First 9 Prime Fibonacci Number
 Five weekends
 FizzBuzz
 Floyd's triangle
 Formatted numeric output
 Four bit adder
 Fractal tree
 Frobenius numbers
 Function definition
G
 Galton box animation
 Generate lower case ASCII alphabet
 Generator/Exponential
 Generic swap
 Globally replace text in several files
 Gray code
 Greatest common divisor
 Greatest element of a list
 Greatest subsequential sum
 Greyscale bars/Display
 Guess the number
 Guess the number/With feedback
 Guess the number/With feedback (player)
 GUI/Maximum window dimensions
H
 Hailstone sequence
 Halt and catch fire
 Happy numbers
 Harshad or Niven series
 Haversine formula
 Hello world/Graphical
 Hello world/Line printer
 Hello world/Newline omission
 Hello world/Standard error
 Hello world/Text
 Here document
 Hilbert curve
 Hofstadter Q sequence
 Honeycombs
 Horizontal sundial calculations
 Horner's rule for polynomial evaluation
 Host introspection
I
 Identity matrix
 Idiomatically determine all the characters that can be used for symbols
 Idiomatically determine all the lowercase and uppercase letters
 Image noise
 Include a file
 Increment a numerical string
 Infinity
 Input loop
 Integer comparison
 Integer overflow
 Integer sequence
 ISBN13 check digit
 Iterators
K
L
 Langton's ant
 Largest difference between adjacent primes
 Largest five adjacent number
 Largest number divisible by its digits
 Largest palindrome product
 Largest prime factor
 Largest product in a grid
 Largest proper divisor of n
 Last Friday of each month
 Last list item
 Leap year
 Least common multiple
 Length of an arc between two angles
 Leonardo numbers
 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
 Luhn test of credit card numbers
M
 Machine code
 Magic 8ball
 Magic constant
 Mandelbrot set
 Map range
 Matrix multiplication
 Maximum difference between adjacent elements of list
 Maze generation
 McNuggets problem
 Memory allocation
 Menu
 Middle three digits
 Minimal steps down to 1
 Minimum multiple of m where digital sum equals m
 Minimum primes
 Modular inverse
 Monte Carlo methods
 Monty Hall problem
 Morse code
 Mouse position
 Multifactorial
 Multiple distinct objects
 Multiplication tables
 Munching squares
 Musical scale
 Mutual recursion
N
 Nqueens problem
 Naming conventions
 Narcissistic decimal number
 Neighbour primes
 Nested function
 Nondecimal radices/Convert
 Nondecimal radices/Input
 Nondecimal radices/Output
 Nth root
 Number names
 Number reversal game
 Numbers divisible by their individual digits, but not by the product of their digits.
 Numbers in base 10 that are palindromic in bases 2, 4, and 16
 Numbers in base16 representation that cannot be written with decimal digits
 Numbers which binary and ternary digit sum are prime
 Numbers whose count of divisors is prime
 Numbers with equal rises and falls
 Numbers with prime digits whose sum is 13
 Numbers with same digit set in base 10 and base 16
 Numeric separator syntax
 Numerical integration
O
P
 Palindrome detection
 Palindromic primes
 Palindromic primes in base 16
 Pangram checker
 Pascal's triangle
 Pascal's triangle/Puzzle
 Pentagram
 Perfect numbers
 Perfect shuffle
 Permutations
 Permutations by swapping
 Permuted multiples
 Pick random element
 Pig the dice game
 Pinstripe/Display
 Piprimes
 Plasma effect
 Playing cards
 Plot coordinate pairs
 Pointers and references
 Polynomial derivative
 Positive decimal integers with the digit 1 occurring exactly twice
 Pragmatic directives
 Price fraction
 Primality by trial division
 Prime numbers p which sum of prime numbers less or equal to p is prime
 Prime numbers which contain 123
 Prime numbers which sum of digits is also prime
 Prime triplets
 Primes which contain only one odd digit
 Primes whose first and last number is 3
 Primes with digits in nondecreasing order
 Probabilistic choice
 Program termination
 Proper divisors
 Pseudorandom numbers/Middlesquare method
R
 Random number generator (device)
 Random number generator (included)
 Range expansion
 Rate counter
 Read a file line by line
 Read a specific line from a file
 Read entire file
 Real constants and functions
 Remove duplicate elements
 Remove vowels from a string
 Repeat a string
 Resistor mesh
 Return multiple values
 Reverse a string
 Reverse the order of lines in a text file while preserving the contents of each line
 Roman numerals/Decode
 Roman numerals/Encode
 Rot13
 Roundrobin tournament schedule
 Runlength encoding
 RuthAaron numbers
S
 Safe and Sophie Germain primes
 Safe primes and unsafe primes
 Scope/Function names and labels
 Search a list
 SEDOLs
 Selfdescribing numbers
 Semordnilap
 Sequence of nonsquares
 Sequence of primes by trial division
 Sequence: smallest number greater than previous term with exactly n divisors
 Shoelace formula for polygonal area
 Show ASCII table
 Show the (decimal) value of a number of 1s appended with a 3, then squared
 Sierpinski carpet
 Sierpinski triangle
 Sierpinski triangle/Graphical
 Sieve of Eratosthenes
 Simple windowed application
 Singlylinked list/Element definition
 Singlylinked list/Traversal
 Smallest multiple
 Smallest square that begins with n
 Snake
 Solve equations with substitution method
 Solve the no connection puzzle
 Sort an array of composite structures
 Sort an integer array
 Sort primes from list to a list
 Sort the letters of string in alphabetical order
 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
 Special Divisors
 Special neighbor primes
 Special pythagorean triplet
 Spiral matrix
 Split a character string based on change of character
 Stack
 Stairclimbing puzzle
 Steady Squares
 String case
 String concatenation
 String length
 String matching
 Strip a set of characters from a string
 Strip control codes and extended characters from a string
 Strip whitespace from a string/Top and tail
 Strong and weak primes
 Substring primes
 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 elements below main diagonal of matrix
 Sum of first n cubes
 Sum of primes in odd positions is prime
 Sum of square and cube digits of an integer are primes
 Sum of squares
 Sum of the digits of n is substring of n
 Sum of two adjacent numbers are primes
 Summarize primes
 Summation of primes
 Symmetric difference
 System time
T
 Taxicab numbers
 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
 Test integerness
 The Twelve Days of Christmas
 ThueMorse
 Tictactoe
 Time a function
 Tokenize a string
 Topswops
 Towers of Hanoi
 Trabb Pardo–Knuth algorithm
 Trigonometric functions
 Truncatable primes
 Two identical strings