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. Some tasks were implemented using EXPL-32.
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 820 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
- Fixed length records
- FizzBuzz
- Flow-control structures
- Floyd's triangle
- Forbidden numbers
- Fork
- Formatted numeric output
- Forward difference
- Four bit adder
- Four sides of square
- Fractal tree
- Frobenius numbers
- Function definition
- Function frequency
- Fusc sequence
G
- Galton box animation
- Gamma function
- Gapful numbers
- General FizzBuzz
- 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
- Golden ratio/Convergence
- 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
- Hamming numbers
- 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
- Humble numbers
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
- Implicit type conversion
- Include a file
- Inconsummate numbers in base 10
- Increasing gaps between consecutive Niven numbers
- Increment a numerical string
- Infinity
- Input loop
- Input/Output for lines of text
- Input/Output for pairs of numbers
- Integer comparison
- Integer overflow
- Integer roots
- Integer sequence
- Inventory sequence
- ISBN13 check digit
- Iterated digits squaring
- Iterators
J
K
L
- Lah numbers
- 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
- Longest common substring
- 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
- Loops/Wrong ranges
- Ludic numbers
- Luhn test of credit card numbers
M
- Machine code
- Magic 8-ball
- Magic constant
- Magic squares of odd order
- Magnanimous numbers
- Mandelbrot set
- Map range
- Matrix multiplication
- Matrix transposition
- Matrix with two diagonals
- Maximum difference between adjacent elements of list
- Maximum triangle path sum
- Maze generation
- McNuggets problem
- Meissel–Mertens constant
- Memory allocation
- Memory layout of a data structure
- Menu
- Mersenne primes
- Mertens function
- Metronome
- Mian-Chowla sequence
- Middle three digits
- Mind boggling card trick
- 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
- Multiplicatively perfect numbers
- Multisplit
- Munchausen numbers
- Munching squares
- Musical scale
- Mutual recursion
- Möbius function