Category:XPL0
This programming language may be used to instruct a computer to perform a task.
See Also: |
|
---|
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 IBM-type PCs. Programs run under Linux, Windows, and DOS. Free, open-source versions of the compilers (interpreted, assembly-code compiled, and optimizing) are available from the official website: xpl0.org [1]. The 32-bit 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 built-in 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 built-in routine number 12, which outputs strings. There are over a hundred of these built-in routines that provide capabilities such as input and output, graphics, and trig functions.
The 32-bit versions of the compilers (as opposed to the older, 16-bit versions) automatically declare code declarations. Thus the above program can simply be written as:
Text(0, "Hello World!")
Pages in category "XPL0"
The following 200 pages are in this category, out of 680 total.
(previous page) (next page)F
- Find words with alternating vowels and consonants
- First 9 prime Fibonacci number
- First perfect square in base n with n unique digits
- Five weekends
- FizzBuzz
- Floyd's triangle
- Fork
- Formatted numeric output
- Four bit adder
- Four sides of square
- Fractal tree
- Frobenius numbers
- Function definition
- Fusc sequence
G
- Galton box animation
- Gapful numbers
- Generate Chess960 starting position
- Generate lower case ASCII alphabet
- Generate random numbers without repeating a value
- Generator/Exponential
- Generic swap
- Giuga numbers
- Globally replace text in several files
- Goldbach's comet
- 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
- Harmonic series
- 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
- Honaker primes
- 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
- Idoneal numbers
- Image noise
- Include a file
- Inconsummate numbers in base 10
- Increment a numerical string
- Infinity
- Input loop
- Input/Output for lines of text
- Input/Output for pairs of numbers
- 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
- Law of cosines - triples
- 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
- Long year
- Look-and-say sequence
- Loop over multiple arrays simultaneously
- Loops/Break
- Loops/Continue
- Loops/Do-while
- Loops/Downward for
- Loops/For
- Loops/For with a specified step
- Loops/Foreach
- Loops/Infinite
- Loops/N plus one half
- Loops/Nested
- Loops/While
- Loops/With multiple ranges
- Luhn test of credit card numbers
M
- Machine code
- Magic 8-ball
- Magic constant
- Magnanimous numbers
- Mandelbrot set
- Map range
- Matrix multiplication
- Matrix transposition
- Matrix with two diagonals
- Maximum difference between adjacent elements of list
- Maze generation
- McNuggets problem
- Meissel–Mertens constant
- Memory allocation
- Menu
- Mersenne primes
- Middle three digits
- Minimal steps down to 1
- Minimum multiple of m where digital sum equals m
- Minimum number of cells after, before, above and below NxN squares
- Minimum numbers of three lists
- Minimum primes
- Modular inverse
- Monte Carlo methods
- Monty Hall problem
- Morse code
- Mosaic matrix
- Mouse position
- Multi-dimensional array
- Multifactorial
- Multiple distinct objects
- Multiplication tables
- Munchausen numbers
- Munching squares
- Musical scale
- Mutual recursion
- Möbius function
N
- N'th
- N-queens problem
- Naming conventions
- Narcissistic decimal number
- Neighbour primes
- Nested function
- Nice primes
- Non-decimal radices/Convert
- Non-decimal radices/Input
- Non-decimal 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 base-16 representation that cannot be written with decimal digits
- Numbers which are not the sum of distinct squares
- Numbers which are the cube roots of the product of their proper divisors
- Numbers whose binary and ternary digit sums 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