🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #2109

Re: stupid cascade of errors

#2109
From: Ross Finlayson
Date: Wed, 02 Dec 2026 21:21
104 lines
5614 bytes
On 12/02/2026 12:17 PM, fir wrote:
> when you do a mistake and say left one not needed ) or }
> compiler make very long cascade of idiotic errors
>
> do they really must be so stupid?


Sometimes it's hard to think while computing.

Thinking while computing, ....

It's usually called "principle of least surprise" or
"principle of least astonishment" not giving the compiler
that's got the scanner and look-ahead or about 3 bytes of memory
since it was compiled into a finite-state-automaton the scanner
then parser or tokenizer/lexer the scanner or about a push-down
automaton in nesting and quoting constructs including comments and
escape characters: wrong-way brackets, all the way to the end-of-file.

Grammars are usually described in terms of what they accept -
maybe then for as so what they'd reject. ("Too deep, ..., too far, ...,
passed another accepted construct ignoring that, ....")
For example, a general rejector that starts always acting
as an accepter, to reject for what's not being accepted.


"Classroom compilers", ....


There's a general rule: "It's not a bug in the compiler,
there's a problem between keyboard and chair."


Many modern accounts of parsing are multi-pass parsers
and mostly don't reflect the text-book class-room reality.
Something like "Tree-Sitter", for example, it's sitting
on quite a large tree. Here instead is a usual idea
that parsing makes passes in sequences, sort of an,
"abstract syntax sequence" instead of "abstract syntax tree",
i.e., the source is a sequence, the tokens is a sequence,
the statements are a sequence, the blocks are a sequence,
un-parsed code is the literal source,
then there's blocks nest, expressions nest, ....


So, nesting and bracketing about groupers and joiners
or comma and separators, vis-a-vis, quoting-contexts
and escape-contexts and comments and whither whitespace,
with affixes and a bunch of different accounts of what
makes productions of terminals vis-a-vis grammars and
syntax or railroad diagrams that involve left-right scanning
or multi-pass scanning and parsing, usually delegated
to manipulation of the tree after the usual top-down
vis-a-vis bottom-up sorts of accounts of parsing, single-pass,
has that there's not much usual formal literature about
machines that parse vis-a-vis the usual text-book account.


Trying to find parser-generators usually, since it's considered
that regular-expressions and usual grammars must have small
and fast implementations usually given to using least-space
in the old days and so not necessarily sort of organized
about for example "run it up branchless the alternatives",
vis-a-vis lookup-tables and jumping all over the code-segment,
it varies.


If you're going to the trouble of parsing something,
might at least allocate five or ten times as much
memory as is being parsed and make markers over passes,
then those can be picked through for the logic
and discarded (or, re-used, for example that the
locator of the construct in the AST if to result
points to the offset in the source text).




Not so necessarily relevant though many machines are
simply running regular-expressions all day or compiling
code all day or making to/from string all day. Then,
at least the compiler's telling you something's wrong,
think how bad C++ programmers have it when it dumps
template logic which isn't even exactly C++ any-more,
learn to appreciate it, then also giving it -Wall -Wextra
-Werror then cleaning up the code always seems a good idea.


I have found bugs in the compiler once or twice in
the count-less yet count-ably many times scutinizing
the compiler results of my or others' designs, that,
though, was long after I stopped looking for them.

Over on comp.theory I emitted a bunch of design notes
about "Viswath & Charmaigne", about, "the character-machine",
about vectorizing the parsing, yet the account of the
"multi-pass parser" and data-structure of the _sequences_
and the overlay their _sequences_ (since, they're all
the same size), is considered an account of second-course
school-work.

A sequitur cascade of sequiturs, ....

Technical Details
Message-ID: <nlmdnS7uoOV1Fo32nZ2dnZfqn_WdnZ2d@giganews.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!weretis.net!feeder9.news.weretis.net!border-3.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
References: <11epud7$3fup6$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!weretis.net!feeder9.news.weretis.net!border-3.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 02 Dec 2026 21:21:44 +0000
Subject: Re: stupid cascade of errors
Newsgroups: comp.lang.c
References: <11epud7$3fup6$1@dont-email.me>
From: Ross Finlayson <ross.a.finlayson@gmail.com>
Date: Wed, 2 Dec 2026 13:21:52 -0800
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
 Thunderbird/38.6.0
MIME-Version: 1.0
In-Reply-To: <11epud7$3fup6$1@dont-email.me>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <nlmdnS7uoOV1Fo32nZ2dnZfqn_WdnZ2d@giganews.com>
Lines: 104
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-uUU+OJ74gt5X0AoOri8uX9DDmXD64076rkq0RLRmX6/bnVjBabC+KgxQFXMaRtiY8bGlWpOgRuNH/1L!6ZShl4yBbacp8W3qXWyoPyD1sU+39j3oPVbF69CW3tm4JjUaFO3Wsndt52eJdpmjJ7Xt27i0f/Ge
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40