Category:PL/0: Difference between revisions

no edit summary
(Added features.)
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1:
{{language|PL/0
|tags=pl0}}
'''PL/0''' is an educational programming language. It was originally introduced in the book, ''Algorithms + Data Structures = Programs'', by [[Niklaus Wirth]] in 1976. Wirth uses PL/0 as an example of how to construct a compiler. This language has littlesimple constructs. Writing real applications in PL/0 is not practical, but the compiler can remain compact and simple.
 
== Features ==
One must explicitly declare all used constants and variables.
 
The only data type areis integer numbers. The only operators are arithmetical and comparison onescomparisons. There is a function <code>odd</code> whichthat examines if theits integer argument is odd.
 
In the original implementation presented by Wirth, there are no input and output routines. The compilerinterpreter prints the new value of each variable when it becomes changedchanges. So, the program:
<syntaxhighlight lang="pascal">
var a, b;
Line 20:
end.
</syntaxhighlight>
gives thethis output:
<pre>
0
Line 35:
5
</pre>
MostHowever, most implementations have single input and single output routines.
 
The flow control structures are ''if-then'' and ''while-do'' constructs, and procedures are defined by the user. Procedures cannot accept any parameters.
 
== Syntax ==
Line 67:
Wirth in his book presents the implementation without <code>?</code> ("receive an integer value and assign it to the variable") and <code>!</code> ("display a value of the expression") routines. Some implementations use other routines for receiving and displaying data, usually <code>read</code> and <code>write</code>.
 
Due to typograhictypographic conventions, Wirth uses non-ASCII symbols <code>≠</code>, <code>≤</code>, and <code>≥</code>. Some implementations use <code>#</code> for "not equal", <code>[</code> for "less or equal", and <code>]</code> for "greater or equal".
 
Some implementations accept only upper-caseuppercase letters or only lower-caselowercase letters in keywords and identifiers.
 
== External links==
297

edits