Meet FP and PL/0

It's been quite some time since I did some work on M4M. I consider myself lucky to have met a good friend: FP Vonck from Amsterdam. We met through the internet and we have been influencing eachother over the years.
FP set out to work with the Oberon operating system. This is more work than a normal person would imagine. The majority of people go the easy route: buy a pre installed Windows (TOS [see below]) and enjoy the colourful madness of the internet. Other people install a flavor of Unix or Linux. After some reading and getting familiar with, it is a good replacement for TOS (The Other System [see above]).
But FP chose for one of the odd ball operating system: Oberon. One of the best from a technological point of view but only very few actual users, let alone developers. As of this moment the Oberon family has one more active member. FP started to develop Oberon software for the Serilux project.

Choosing an odd ball operating system or an odd ball programming language makes better engineers. You cannot follow the mainstream because there is no mainstream. YOU ARE the mainstream! So you need to dig through search engines and libraries to get to your information and documentation. FP, living in Amsterdam, has the advantage of living in a city with two major universities, each with a good library.
FP and I discuss things. I know some Modula-2 and have played with Oberon in the past so I have some experience. But FP has a great mind. And in one of our conversations he mentioned the PL/0 (Pee El Nil) programming language which was used by Professor Niklaus Wirth in some of his early books as a case study for constructing a compiler.
PL/0 is a simple language. Too simple for modern day computers but a very good choice for micro controllers. In a micro, you rarely need floating point numbers or negative numbers. These are from the realm of banks and tax agencies. But a temperature (expressed in Kelvin) cannot be negative! All AD converters deliver positive numbers! And for the rare case you cannot do without negative numbers, you can work with an offset (like in the Celsius scale which is identical to the Kelvin scale, with the difference that Celsius has an offset of 273 K).

EBNF of PL/0

Professor Wirth made his PL/O language in the 1970's and it has some resemblance with his Pascal language of the time. Below is the EBNF definition of the language (I have stolen it from Wikipedia).

PL/0 Syntax (Version 2.0)
 
Program = "PROGRAM" Ident ";" Block Ident ".".
Block = {ConstDeclaration | VarDeclaration | ProcDeclaration} BlockBody.
ConstDeclaration = "CONST" Ident "=" Number {"," Ident "=" Number} ";".
VarDeclaration = "VAR" Ident {"," Ident} ";".
ProcDeclaration = "PROCEDURE" Ident [":" Ident] ";" Block Ident ";".
BlockBody = "BEGIN" StatementSequence "END".
StatementSequence = Statement {";" Statement}.
Statement = Assignment |
StandardProcCall |
ProcedureCall |
IfStatement |
WhileStatement |
RepeatStatement |
ReturnStatement |
.
Assignment = Ident ":=" Expression.
StandardProcCall = "Read" Ident | "WriteLn" | "Write" "(" Expression {"," Expression} ")".
ProcedureCall = Ident.
IfStatement = "IF" Condition "THEN" StatementSequence
{"ELSIF" Condition "THEN" StatementSequence}
["ELSE" StatementSequence]
"END".
WhileStatement = "WHILE" Condition "DO" StatementSequence "END".
RepeatStatement = "REPEAT" StatementSequence "UNTIL" condition.
ReturnStatement = "RETURN".
Condition = "ODD" Expression |
Expression ("=" | "#" | "<>" | "<" | "<=" | ">" | ">=") Expression.
Expression = ["+" | "-"] Term {("+" | "-") Term}.
Term = Factor {("*" | "/" | "DIV" | "%" | "MOD") Factor}.
Factor = Ident | Number | "(" Expression ")".
Number = Digit {Digit}.
Ident = Letter {Letter | Digit}.
Digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9".
Letter = "a" | "b" | .. | "y" | "z" | "A" | "B" | .. | "Y" | "Z".

EBNF of Plov

Plov will use the PL/0 EBNF definition as a start. I want to add some syntax from Tcl/Tk and similar languages. One thing: why use a semicolon, if there also is a LineFeed to terminate a command? Also: all keywords need to be separated by whitespace.

Plov Syntax (Version 0.1)
 
Program = "PROGRAM" Ident Block Ident.
Block = {ConstantDeclaration | VariableDeclaration | ProcedureDeclaration} BlockBody.
ConstantDeclaration = "CONSTANTS" Ident "=" Number {Ident "=" Number} "END".
VariableDeclaration = "VARIABLES" Ident {Ident} "END".
ProcedureDeclaration = "PROCEDURE" Ident Block Ident.
BlockBody = "BEGIN" StatementSequence "END".
StatementSequence = Statement { Statement } .
Statement = Assignment |
ProcedureCall |
IfStatement |
LoopStatement |
RepeatStatement |
WhileStatement |
ExitStatement |
ReturnStatement .
Assignment = Identifier ":=" Expression .
ProcedureCall = Identifier .
IfStatement = "IF" Condition "THEN" StatementSequence
{"ELSIF" Condition "THEN" StatementSequence}
["ELSE" StatementSequence]
"END" .
LoopStatement = "LOOP" StatementSequence "END" .
WhileStatement = "WHILE" Condition "DO" StatementSequence "END" .
RepeatStatement = "REPEAT" StatementSequence "UNTIL" Condition.
ExitStatement = "EXIT" .
ReturnStatement = "RETURN" .
Condition = "ODD" Expression |
Expression ("=" | "#" | "<>" | "<" | "<=" | ">" | ">=") Expression .
Expression = Term {("+" | "-") Term} .
Term = Factor {(".") | ("x") | ("*" | "/" | (":" | ("%") | "MOD") Factor} .
Factor = Identifier | Number | "(" Expression ")" .
Number = Digit {Digit} .
Identifier = Letter {Letter | Digit} .
Digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9".
Letter = "a" | "b" | .. | "y" | "z" | "A" | "B" | .. | "Y" | "Z".

Page created on 25 August 2007 and

Page equipped with FroogleBuster technology