| Related articles |
|---|
| [8 earlier articles] |
| Re: A tiny self-hosting compiler used for teaching michael.lehn@uni-ulm.de (Michael Lehn) (2026-09-05) |
| Re: A tiny self-hosting compiler used for teaching michael.lehn@uni-ulm.de (Michael Lehn) (2026-09-05) |
| Re: A tiny self-hosting compiler used for teaching gneuner2@comcast.net (George Neuner) (2026-09-07) |
| Re: A tiny self-hosting compiler used for teaching christopher.f.clark@compiler-resources.com (Christopher F Clark) (2026-09-07) |
| Re: A tiny self-hosting compiler used for teaching michael.lehn@me.com (Michael Lehn) (2026-09-05) |
| Re: A tiny self-hosting compiler used for teaching ram@zedat.fu-berlin.de (2026-09-08) |
| Re: A tiny self-hosting compiler used for teaching martin@gkc.org.uk (Martin Ward) (2026-09-09) |
| From: | Martin Ward <martin@gkc.org.uk> |
| Newsgroups: | comp.compilers |
| Date: | Wed, 09 Sep 2026 11:55:00 +0100 |
| Organization: | Compilers Central |
| References: | <1732889e-587a-bab7-6f03-18fcbfb5d090@gkc.org.uk> |
| 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 |
| In-Reply-To: | <1732889e-587a-bab7-6f03-18fcbfb5d090@gkc.org.uk> |
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
Return to the
comp.compilers page.
Search the
comp.compilers archives again.