Category:XPL0: Difference between revisions

From Rosetta Code
Content added Content deleted
m (Clarified need for 'code' declarations)
mNo edit summary
 
(2 intermediate revisions by one other user not shown)
Line 3: Line 3:
by Peter J. R. Boyle, who designed it to run on a 6502 microprocessor as
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
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
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
book ''Algorithms + Data Structures = Programs'' by Niklaus Wirth. The first
XPL0 compiler was written in ALGOL, which was then used to create a compiler
XPL0 compiler was written in ALGOL, which was then used to create a compiler
Line 9: Line 9:


XPL0 has been implemented on more than a dozen processors, but it's
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
currently maintained on the Raspberry Pi and IBM-type PCs. Programs run under Linux, Windows, and MS-DOS. Free, open-source versions of the
compilers (interpreted, assembly-code compiled, and optimizing) are
compilers (interpreted, assembly-code compiled, and optimizing) are
available from the official website: xpl0.org [http://www.xpl0.org/]. 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.
available from the official website: xpl0.org [http://www.xpl0.org/]. The 32-bit version of the MS-DOS compiler, XPLPX, was used for many 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:
Here's how the traditional Hello World program is coded:
Line 31: Line 31:
functions.
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:
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 rewritten as:


<pre>
<pre>

Latest revision as of 16:37, 3 October 2023

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


Listed below are all of the tasks on Rosetta Code which have been solved using 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 IBM-type PCs. Programs run under Linux, Windows, and MS-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 MS-DOS compiler, XPLPX, was used for many 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 rewritten as:

      Text(0, "Hello World!")

Subcategories

This category has the following 2 subcategories, out of 2 total.

@

Pages in category "XPL0"

The following 200 pages are in this category, out of 863 total.

(previous page) (next page)

C

(previous page) (next page)