<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 29, 2020 at 10:31 AM Pete Wright <<a href="mailto:pete@nomadlogic.org">pete@nomadlogic.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On 10/28/20 6:44 PM, R. Clayton wrote:<br>
> It's van Wyk's thesis work under Knuth on Ideal, a constraint-based little<br>
> language for describing pictures, so I'm guessing it's from whatever they had<br>
> going at Stanford in the late '70s. I'm hoping it's a common-knowledge idiom<br>
> that has subsided into obscurity over time, and I'm trying to find long-timer<br>
> who will look at it and say "Oh yeah, that...".<br>
<br>
If you aren't already subscribed to TUHS <br>
(<a href="https://minnie.tuhs.org/mailman/listinfo/tuhs" rel="noreferrer" target="_blank">https://minnie.tuhs.org/mailman/listinfo/tuhs</a>) it might be worth <br>
sending a message to that list. I've found it really useful resource <br>
for things like this, often getting information directly from the people <br>
involved.<br></blockquote><div><br></div><div>Late 70's would be either the PWB version of lex, or the V7 version.</div><div><br></div><div>But looking at the V7 version, we see</div><div><br></div>header.c: fprintf(fout,"# define BEGIN yybgin = yysvec + 1 +\n");<br><div><br></div><div>but today's flex generates:</div><div><br></div><div>#define BEGIN (yy_start) = 1 + 2 *<br></div><div><br></div><div>so the +1 could get to the other half. Lex generates #defines for each of these states that are sequential.</div><div><br></div><div>Rummaging around in the code a bit, I see that yy_at_bol is used when we're at the start of the line. It's 1 at start of line and 0 otherwise.</div><div><br></div><div>So my best guess is that the PROGRAM+1 transitions to the parser state as if it were the start of the line (or is trying to) even if it really isn't at the start of a line.</div><div><br></div><div>The matches this that I found in the flex manual:</div><div> The macro yy_set_bol(at_bol) can be used to control whether the current<br> buffer's scanning context for the next token match is done as though at<br> the beginning of a line. A non-zero macro argument makes rules<br> anchored with<br> '^' active, while a zero argument makes '^' rules inactive.<br><br> The macro YY_AT_BOL() returns true if the next token scanned from the<br> current buffer will have '^' rules active, false otherwise.<br></div><div>as well as scattered references to line based parsing.</div><div><br></div><div>The next layer of details, though, requires more study than I have time for right now :)</div><div><br></div><div>Reading your grammar that way, does it track?</div><div><br></div><div>Warner</div></div></div>