Frank Heckenbach wrote:
Eike Lange wrote:
On Tue, Jun 04, 2002 at 10:16:21AM -0400, CBFalconer wrote:
He told me, that stopping after the first "end." (after unit) should stop the compiler. I don't know, why he has written the program in the same file so far. :-/
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 :-)
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. Thus I had to buffer the input in lines for printing only after completion of parsing of a line. Thus the one character look-ahead had a tendency to issue a read after EOF. Things were much easier when the '.' was not the last character in the source file.
This characteristic is convenient for appending rambling notes after the final "end." without worrying about forming proper comments. Doesn't work for C though.
BTW I just ran across a fascinating essay at:
http://www.epemag.com/zuse/forword.htm
which might especially interest you.