🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #152

Re: Comment delimiters

#152
From: Anton Ertl
Date: Fri, 16 Oct 2026 17:10
74 lines
5032 bytes
Thomas Koenig <tkoenig@netcologne.de> writes:
>Anton Ertl <anton@mips.complang.tuwien.ac.at> schrieb:
>>    and even later, e.g., Wirth does not
>>    make this distinction in his language definitions, using EBNF down
>>    to the lexical level (although he does define reserved words).
>
>Also in modern language definition.  Separating lexing and parsing
>is a matter of convenience, especially since regular expressions
>have been introduced, and speed.

Speed, yes, but it is also a matter of differences in handling of
ambiguities.  Scanning resolves ambiguities with longest input match,
whereas parsing tends to avoid ambiguities, with only few exceptions
(like the dangling else in some languages, but not, e.g., Algol 60,
which is the first language that used BNF).

As for convenience, for various compilers I read that either the
scanner or the parser (or both) were hand-written (I don't remember
which one was more frequent).  It certainly does not seem much work to
write a scanner for a typical programming language by hand (you
recognize keywords by table lookup of things that will be classified
as identifiers if they are not in the table).  For the parser of a
language that is not LL(1), it's more work, but writing it by hand
allows you to do various things that, e.g., bison does not support
(ANTLR has support for "syntactic predicates" and "semantic
predicates", which probably is good enough for a lot of cases; it was
written with C++ in mind).

>> b) Without this distinction, if you ignore white space at all, you
>>    either ignore it everywhere, or give it a special role in your
>>    syntax.  Ignoring is probably simpler.
>
>The added complication of separate handling of whitespace is minor.
>For the original FORTRAN, they skipped them because card punch operators
>often made mistakes with spaces.

That's a good reason, but it seems to have disappeared with the next
generation of programming languages.  Were programmers later punching
their own cards, or were they writing programs in a way that made
spaces obvious?

>> c) The programming language community took quite a while until it
>>    arrived at reserved words.
>
>Reserved words make the compiler writer's job easier (somewhat,
>but not tremendously), but not having them is a solved problem.
>Users are left holding the bag if a new version of the language
>introduces new keywords.

I don't think they worried about program maintainence across several
Fortran versions when they worked on the original Fortran.  It does
not contain subroutines.

>> d) Does the original FORTRAN support continuation cards?
>
>Yes, it would have extremely restricted otherwise.

The original FORTRAN was extremely restricted.

When I used Microsoft BASIC on the C64, where Commodore's line editor
prevented lines longer than 80 characters, including line numbers, I
did not find that particularly restrictive, especially given all the
other limitations of that version of BASIC, such as no graphics or
sound support apart from POKE and SYS.  BASIC itself supported lines
up to 252 bytes or so, and IIRC the keywords were already tokenized
there, but you could not input such long lines on Commodore computers.

What in FORTRAN makes single 66-char lines (plus line number)
extremely restricted?

- anton
-- 
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
  Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Technical Details
Message-ID: <2026Oct16.191024@mips.complang.tuwien.ac.at>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <1791742457-5857@newsgrouper.org> <11aig3c$3hdcn$1@dont-email.me> <11aiqc0$3kr94$3@dont-email.me> <179190779286.25645.14465927900754526737@media.vsta.org> <179190779286.25645.14465927900754526737@media.vsta.org> <vandys@vsta.org> <jwvjynl2cg0.fsf-monnier+comp.arch@gnu.org> <808vclt9i2mso89n1itvnvos5j88g1mopl@4ax.com> <6acfc2b2.1547984@news.eternal-september.org> <HZQzS.6$TYg.3@fx21.iad> <2026Oct15.081750@mips.complang.tuwien.ac.at> <11asgjl$328d5$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.arch
Subject: Re: Comment delimiters
Date: Fri, 16 Oct 2026 17:10:24 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 74
Message-ID: <2026Oct16.191024@mips.complang.tuwien.ac.at>
References: <1791742457-5857@newsgrouper.org> <11aig3c$3hdcn$1@dont-email.me> <11aiqc0$3kr94$3@dont-email.me> <179190779286.25645.14465927900754526737@media.vsta.org> <179190779286.25645.14465927900754526737@media.vsta.org> <vandys@vsta.org> <jwvjynl2cg0.fsf-monnier+comp.arch@gnu.org> <808vclt9i2mso89n1itvnvos5j88g1mopl@4ax.com> <6acfc2b2.1547984@news.eternal-september.org> <HZQzS.6$TYg.3@fx21.iad> <2026Oct15.081750@mips.complang.tuwien.ac.at> <11asgjl$328d5$1@dont-email.me>
Injection-Date: Fri, 16 Oct 2026 17:55:53 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3710808"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19bo+dh3R53/+BTb94I0dVI"; posting-host="eb1d16796a2f3c3c419013704a6bb9be"
Cancel-Lock: sha1:2UlQ8+xzrZA5VeuL6wDSpsfI9hc= sha256:GXR0pn+L9K6yeIiqaglCJ6vnTBl1jIlbMbmaMoWucrs=
	sha1:KkZemBiQA8gJ3J2QpNh9sxQFGRM= sha256:q4QNS3O2+gHLzo6f2eMeoN/7bQepub12NgN+3S0Ks+s=
X-newsreader: xrn 10.11