Talk:PL/0
This article is rated C-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||
|
>The example is used in a book by Niklaus Wirth called Compilerbau.
I'm wondering if this (the origin of the EBNF for PL/0 listed in the article) is correct. I have the Algorithms + Data Structures = Programs book by Wirth, which does have the above EBNF. I do not have Compilerbau, but I did find a web reference that claims to have the EBNF for PL/0 v2 from Compilerbau, and the EBNF looks quite different from that listed in the article:
Das PL/0-System soll das Programmieren von Compilern demonstrieren. Siehe : N.Wirth, Compilerbau, Teubner Studienbuecher Informatik, [3]1984.
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}. Digit = "0" | .. | "9". Ident = Letter {Letter | Digit}. Letter = "a" | .. | "z" | "A" | .. | "Z". PL/0 Fakten =========== Kommentare sind in (* ... *) einzuschliežen; keine Kommentarschachtelung. Alle Variablen sind vom Typ LONGINT, d.h. 32 bit breit. "Read x" entspricht "read(x)" in PASCAL, "Write(x,...)" entspricht "write(x,...)", "WriteLn" ebenso. Funktionsprozeduren sind zul„ssig, wie z.B.: "PROCEDURE Function_Example: Return_Value;" Return_Value ist dann zu behandeln wie eine normale Variable und wird an den Rufer zurckgegeben. Rekursive Prozeduraufrufe sind zul„ssig.
January 11, 2006
The EBNF listed does not agree with the compiler source. Specifically, the constant declarations don't agree. Look at the original compiler in Algorithms + Data Structures = Programs (page 344, program 5.6), or look at the compiler at http://www.246.dk/pl0.html (referenced in the wiki PL/0 article). Here is the section of code that parses a constant declaration:
if sym = constsym then begin getsym; repeat constdeclaration; while sym = comma do begin getsym; constdeclaration end; if sym = semicolon then getsym else error(5) until sym <> ident end;
The EBNF listed with the wiki article is:
block = ["CONST" ident "=" number {"," ident "=" number} ";"] ...
A careful inspection of the relevant source code (above), will show that the EBNF should be:
block = [const = "const" constdeclaration ";" {constdeclaration ";"}] ...
constdeclaration = ident "=" number {"," ident "=" number}
From looking at Wirth's syntax diagrams in Algorithms + Data Structures = Programs, it appears he meant the former, but he actually coded the latter.
So, which one is right?
Sam
May 5, 2006
I just looked up the source code in the Compilerbau book. Keywords are really lowercase, like "const", "begin". Lowercase is used both in the EBNF grammar and also in the source code. Wirth's PL/0 example programs also use lowercase. So, everything is consistent.
But why are there so many "wrong" example programs around there today ? The Compilerbau was written in the early 1970s. Since the late 1970s, Wirth used his language MODULA for implementing compilers. MODULA itself had all keywords in uppercase and variables in lowercase. It looks like Wirth took over this habit to later versions of PL/0.In the 1986 edition of Compilerbau, all PL/0 examples use uppercase.
Dead link
editDuring several automated bot runs the following external link was found to be unavailable. Please check if the link is in fact down and fix or remove it in that case!
maru (talk) contribs 04:29, 27 July 2006 (UTC)
- Yep, dead. removed. JonHarder 13:42, 27 July 2006 (UTC)
Update links to external PL/0 compiler
editThe sourceforge link to the PL/0 compiler is fairly old and out of date. I've been working on a PL/0 compiler in Python and if appropriate I believe that link should be replaced.
Here is a link for the source code: http://github.com/oriontransfer/pl0-language-tools
Here is a link for the documentation: http://www.oriontransfer.co.nz/learn/pl0-language-tools
Because I might have a conflict of interest (!?) someone else should check and add these links.
Thanks Ioquatix (talk) 14:43, 23 May 2011 (UTC)
- Whether the old link should be removed and your new link added would seems like two separate questions. I'm not sure if either is very appropriate. I haven't checked, but I suspect neither of the two projects is significantly more advanced than a compiler any computer science undergraduate would write during his or her compiler construction course? —Ruud 16:56, 23 May 2011 (UTC)
Before you make some feedback, why don't you check the difference for yourself. No offense intended, but otherwise it is just a uninformed opinion.
I believe my compiler offers clear benefits to students studying PL/0, so that is why I want to share it with other people who are interested in PL/0:
- My PL/0 is written in Python, which is easier for students to understand than C in general.
- My PL/0 consists of ~6 source files of about 150 lines each vs 99 files with over 5000 lines of source code.
- My PL/0 compiler is designed to be easily comprehendible by new student.
- My PL/0 website has clear step by step documentation explaining how to use compiler and how to understand the compilation steps, vs almost no documentation at all.
- My PL/0 website has zero advertising vs SourceForge which has ads left right and center.
- My PL/0 compiler doesn't require compilation and has few dependencies vs qt, flex, gcc, g++, make, pthread, etc.
- My PL/0 compiler works on any platform supported by python vs Windows & Linux only.
Well, I wouldn't bother posting this here unless I believed there was clear benefit, but I obviously won't add the link myself since it is a clear conflict of interest; so I want some critical and useful discussion to help evaluate what is best for the users of wikipedia - keep in mind that a lot of students probably refer to this page and thus it might be helpful to link to a compiler designed for students. But, I think it would be an improvement. Thanks for your time. Ioquatix (talk) 04:55, 26 May 2011 (UTC)
I have inserted a section on the use of PL/0 in education, mentioning your web page and containing a link to it. My insertion was automatically reverted because of the links in your web page. I un-did the revert, but you should considere cleaning your web page from the many links at the bottom of the page. 91.62.110.104 (talk) 10:15, 18 September 2011 (UTC)
External links modified
editHello fellow Wikipedians,
I have just added archive links to one external link on PL/0. Please take a moment to review my edit. If necessary, add {{cbignore}}
after the link to keep me from modifying it. Alternatively, you can add {{nobots|deny=InternetArchiveBot}}
to keep me off the page altogether. I made the following changes:
- Added archive http://web.archive.org/web/20160106194654/http://www.cs.rochester.edu/courses/254/PLzero/guide.pdf to http://www.cs.rochester.edu/courses/254/PLzero/guide.pdf
When you have finished reviewing my changes, please set the checked parameter below to true or failed to let others know (documentation at {{Sourcecheck}}
).
This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}}
(last update: 5 June 2024).
- If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
- If you found an error with any archives or the URLs themselves, you can fix them with this tool.
Cheers.—cyberbot IITalk to my owner:Online 11:44, 28 February 2016 (UTC)
External links modified
editHello fellow Wikipedians,
I have just modified 3 external links on PL/0. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:
- Added archive https://web.archive.org/web/20120221073635/http://www.ntecs.de/old-hp/uu9r/lang/html/pl0.en.html to http://www.ntecs.de/old-hp/uu9r/lang/html/pl0.en.html
- Added archive https://web.archive.org/web/20130207170133/http://www.inf.ethz.ch/personal/wirth/books/AlgorithmE0/ to http://www.inf.ethz.ch/personal/wirth/books/AlgorithmE0/
- Added archive https://web.archive.org/web/20130207170133/http://www.inf.ethz.ch/personal/wirth/books/AlgorithmE0/ to http://www.inf.ethz.ch/personal/wirth/books/AlgorithmE0/
When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.
This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}}
(last update: 5 June 2024).
- If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
- If you found an error with any archives or the URLs themselves, you can fix them with this tool.
Cheers.—InternetArchiveBot (Report bug) 21:08, 11 December 2017 (UTC)