Path: csiph.com!weretis.net!feeder9.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Martin Ward Newsgroups: comp.compilers Subject: Re: A tiny self-hosting compiler used for teaching Date: Wed, 09 Sep 2026 11:55:00 +0100 Organization: Compilers Central Sender: johnl%iecc.com Approved: comp.compilers@iecc.com Message-ID: <26-09-013@comp.compilers> References: <1732889e-587a-bab7-6f03-18fcbfb5d090@gkc.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="42680"; mail-complaints-to="abuse@iecc.com" Keywords: courses Posted-Date: 13 Sep 2026 20:02:57 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com In-Reply-To: <1732889e-587a-bab7-6f03-18fcbfb5d090@gkc.org.uk> Xref: csiph.com comp.compilers:3765 On 08/09/2026 10:14, ram@zedat.fu-berlin.de wrote: > | Step-by-Step Algorithm This is not an angorithm! For example: > find the location where the identifier would normally be placed. Finding where something would "normally be placed" is not an algorithmic step. It seems to require parsing the abstract declaration to determine where the identifier would "normally" appear. So one step in the "algorithm" to parse a declaration is: parse the declaration! > | - If [], say: "array of . . . " and move past it. OK. Having moved past "[]", the thing to the left of the current position is now "[]", so looking to the left of the current position will never see "*" or a type qualifier. > | 4. Encountering Parentheses: If you hit a closing parenthesis ) on > | the right, you must consume all modifiers to the left until you > | hit the matching opening parenthesis (. Then, step outside the > | parentheses and repeat from Step 2. This seems to imply that we can ignore ("consume") anything in parentheses: these tokens do not affect the dclaration? > | 5. Final Base Type: When the identifier and all modifiers are > | consumed, read the leftmost base type (e.g., int, char). The only step that "consumes" tokens is step 4, the other steps "move past" tokens and leave them in place without consuming them. So this "algorithm" cannot consume anything on a simple declaration which has no parentheses, and so does not terminate on such a declaration. So this is not an algorithm. > | [N] Right " . . . array of N . . . " Above you only had us look for "[]" and not "[N]". > Lines marked with "| " come from my editing, where I start by writing > prompts for the chatbot *Now* we can see where the problem is! Please, in future, mark the top of your comments with some indicator such as "AI generated", so that I can skip your AI slop and not waste time reading and commenting on it. -- Mary Dr Mary Ward | Email: martin@gkc.org.uk | http://www.gkc.org.uk G.K.Chesterton site: http://www.gkc.org.uk/gkc | Erdos number: 4