XPL0
Encyclopedia
XPL0 is a computer programming language that is essentially a cross
between Pascal
and C
. It was created in 1976 by Peter J. R. Boyle who
wanted a high-level language for his microcomputer
and wanted something
more sophisticated than 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
. It generated instructions for a pseudo machine
that was implemented as an interpreter on a Digital Group
computer based
on the 6502 microprocessor. The compiler was converted from ALGOL
to XPL0 and was then able to compile itself and run on a microcomputer.
XPL0 soon proved its worth in a variety of products based on the 6502.
These embedded system
s would otherwise have had their code written
in assembly language
, which is much more tedious to do.
Boyle used XPL0 to write a disk operating system called Apex. Beginning
in 1980 this was sold, along with XPL0, as an alternative to Apple DOS
for the Apple II computer, which was based on the 6502.
Since those early years XPL0 has migrated to other processors and many
features have been added. Open source
versions of the compilers for IBM-style PCs are available from the link
below.
code Text=12;
Text(0, "Hello World!")
Text is a built-in routine 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.
In XPL0 all names must be declared before they can be used. The command
word code associates the name Text to built-in routine number 12,
which is the one that outputs strings. There are about 80 of these
built-in routines that provide capabilities such as input and output,
graphics, and trig functions.
between Pascal
Pascal (programming language)
Pascal is an influential imperative and procedural programming language, designed in 1968/9 and published in 1970 by Niklaus Wirth as a small and efficient language intended to encourage good programming practices using structured programming and data structuring.A derivative known as Object Pascal...
and C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
. It was created in 1976 by Peter J. R. Boyle who
wanted a high-level language for his microcomputer
Microcomputer
A microcomputer is a computer with a microprocessor as its central processing unit. They are physically small compared to mainframe and minicomputers...
and wanted something
more sophisticated than BASIC
BASIC
BASIC is a family of general-purpose, high-level programming languages whose design philosophy emphasizes ease of use - the name is an acronym from Beginner's All-purpose Symbolic Instruction Code....
, which was the dominant language for
personal computers at the time.
XPL0 is based on PL/0
PL/0
At least two programming languages are known as PL/0. One is a subset of IBM's general-purpose programming language PL/I.The other PL/0, covered here, is similar to but much simpler than the general-purpose programming language Pascal, intended as an educational programming language. It serves as...
, an example compiler in the book
Algorithms + Data Structures = Programs by Niklaus Wirth
Niklaus Wirth
Niklaus Emil Wirth is a Swiss computer scientist, best known for designing several programming languages, including Pascal, and for pioneering several classic topics in software engineering. In 1984 he won the Turing Award for developing a sequence of innovative computer languages.-Biography:Wirth...
. The first XPL0 compiler
was written in ALGOL
ALGOL
ALGOL is a family of imperative computer programming languages originally developed in the mid 1950s which greatly influenced many other languages and became the de facto way algorithms were described in textbooks and academic works for almost the next 30 years...
. It generated instructions for a pseudo machine
that was implemented as an interpreter on a Digital Group
The Digital Group
The Digital Group was the first company to produce a system built around the Zilog Z80 processor. Their hobbyist-targeted products were based on a system of interchangeable boards and components which allowed users to upgrade to different CPUs without having to replace their peripherals. Their...
computer based
on the 6502 microprocessor. The compiler was converted from ALGOL
to XPL0 and was then able to compile itself and run on a microcomputer.
XPL0 soon proved its worth in a variety of products based on the 6502.
These embedded system
Embedded system
An embedded system is a computer system designed for specific control functions within a larger system. often with real-time computing constraints. It is embedded as part of a complete device often including hardware and mechanical parts. By contrast, a general-purpose computer, such as a personal...
s would otherwise have had their code written
in assembly language
Assembly language
An assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices. It implements a symbolic representation of the machine codes and other constants needed to program a given CPU architecture...
, which is much more tedious to do.
Boyle used XPL0 to write a disk operating system called Apex. Beginning
in 1980 this was sold, along with XPL0, as an alternative to Apple DOS
Apple DOS
Apple DOS refers to operating systems for the Apple II series of microcomputers from late 1978 through early 1983. Apple DOS had three major releases: DOS 3.1, DOS 3.2, and DOS 3.3; each one of these three releases was followed by a second, minor "bug-fix" release, but only in the case of Apple DOS...
for the Apple II computer, which was based on the 6502.
Since those early years XPL0 has migrated to other processors and many
features have been added. Open source
versions of the compilers for IBM-style PCs are available from the link
below.
Example
This is how the traditional Hello World program is coded in XPL0:code Text=12;
Text(0, "Hello World!")
Text is a built-in routine 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.
In XPL0 all names must be declared before they can be used. The command
word code associates the name Text to built-in routine number 12,
which is the one that outputs strings. There are about 80 of these
built-in routines that provide capabilities such as input and output,
graphics, and trig functions.