CBFalconer wrote:
Frank Heckenbach wrote:
Eike Lange wrote:
On Tue, Jun 04, 2002 at 10:16:21AM -0400, CBFalconer wrote:
Put in those terms, he is absolutely right IMO. Anything that follows the "end ." should be ignored, in fact not even read. The period should be parsed and cause compilation to stop. I think the syntax is something like:
program ::= 'program' progparms ';' declarations block '.'
Yes, but there might be a statement like this (not exactly BNF :-) part ::= program or unit file ::= part until EOF
Yes, I'd also think so. Normally, a grammar doesn't imply that anything may follow the program.
However, BP behaves like this, and GPC does so with `--borland-pascal' (but I don't think we should make this the default).
Who are you agreeing with? I hope it is me :-)
No, Eike who I quoted directly.
I actually had to go to some trouble to get this to work correctly in PascalP, because I allowed EOF to appear immediately after the '.', with no eoln. At the same time I wanted to collect source lines for a listing.
Why don't you just read it as a text file (provided PascalP was written in Pascal)? According to the standard, a text file in Pascal consists of lines, so there is always an EOLn before EOF (whether or not the external file contains a newline at the end).
Obviously, GPC (written in C) doesn't do this, either. It just processes the input character-wise and counts the newlines (for messages) and outputs it character-wise (with `--debug-source').
This characteristic is convenient for appending rambling notes after the final "end." without worrying about forming proper comments.
The question is not whether it's convenient, but whether it's allowed by the standards. Do you have any reference where they allow it?
BTW I just ran across a fascinating essay at:
<http://www.epemag.com/zuse/forword.htm>
which might especially interest you.
Gives me a 404.
Frank