PL/0
Erscheinungsbild
PL/0 ist eine vereinfachte Programmiersprache. Sie dient als Muster, um im Buch Compilerbau von Niklaus Wirth zu zeigen, wie man einen Compiler herstellt. Die Sprache kann nur mit Zahlenwerten umgehen und ist nicht dazu gedacht, wirklich eingesetzt zu werden. PL/0 ist außerdem eine Untermenge der Programmiersprache PL/I von IBM.
Die Syntaxregeln der Modellsprache in EBNF:
<syntaxhighlight lang="ebnf">
program = block "." .
block = [ "CONST" ident "=" number { "," ident "=" number } ";" ]
[ "VAR" ident { "," ident } ";" ]
{ "PROCEDURE" ident ";" block ";" } statement .
statement = [ ident ":=" expression | "CALL" ident | "?" ident | "!" expression |
"BEGIN" statement { ";" statement } "END" |
"IF" condition "THEN" statement |
"WHILE" condition "DO" statement ] .
condition = "ODD" expression |
expression ( "=" | "#" | "<" | "<=" | ">" | ">=" ) expression .
expression = [ "+" | "-" ] term { ( "+" | "-" ) term } .
term = factor { ( "*" | "/" ) factor } .
factor = ident | number | "(" expression ")" .
</syntaxhighlight>
Weblinks
- {{#invoke:Vorlage:Literatur|f}}
- sourceforge.net
- Development of a PL/0 style compiler based on 'Compiler construction' written in Mocka (Modula-2 for Linux)
- Category:PL/0 In PL/0 auf rosettacode.org implementierte Aufgaben
- https://github.com/hindermath/TinyPl0 (Portierung von PL/0 mit Agentic-AI zu .Net10/C# 14 als CLI- und TUI-Apps)