* [9fans] yacc's YYMAXDEPTH
@ 2025-08-06 14:31 Anthony Sorace
2025-08-06 15:22 ` Charles Forsyth
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Anthony Sorace @ 2025-08-06 14:31 UTC (permalink / raw)
To: 9fans
I've just run into awk code where yacc's default YYMAXDEPTH of 150 causes stack exhaustion; increasing it lets the code work fine. It's been 150 since at least v7 Unix (I didn't have earlier on hand to check), and our systems are a little bigger now; it seems safe to bump up quite a bit.
Is anyone aware of yacc-generated code which uses this value as a check, rather than just being the more obvious guard against using too much system resources?
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Td74874a3700432ac-M46bbad427b6d39bec9bd8547
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] yacc's YYMAXDEPTH
2025-08-06 14:31 [9fans] yacc's YYMAXDEPTH Anthony Sorace
@ 2025-08-06 15:22 ` Charles Forsyth
2025-08-06 18:25 ` ori
2025-08-08 18:40 ` Bakul Shah via 9fans
2 siblings, 0 replies; 7+ messages in thread
From: Charles Forsyth @ 2025-08-06 15:22 UTC (permalink / raw)
To: 9fans
[-- Attachment #1: Type: text/plain, Size: 963 bytes --]
I changed the Limbo one to pass the initial stack size through (the value
of YYMAXDEPTH, default 200) but the parser grows the stack if it needs to.
I don't remember anything noticing.
On Wed, 6 Aug 2025 at 15:35, Anthony Sorace <a@9srv.net> wrote:
> I've just run into awk code where yacc's default YYMAXDEPTH of 150 causes
> stack exhaustion; increasing it lets the code work fine. It's been 150
> since at least v7 Unix (I didn't have earlier on hand to check), and our
> systems are a little bigger now; it seems safe to bump up quite a bit.
>
> Is anyone aware of yacc-generated code which uses this value as a check,
> rather than just being the more obvious guard against using too much system
> resources?
>
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Td74874a3700432ac-M5138ee43829825c59352b4cb
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
[-- Attachment #2: Type: text/html, Size: 2197 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] yacc's YYMAXDEPTH
2025-08-06 14:31 [9fans] yacc's YYMAXDEPTH Anthony Sorace
2025-08-06 15:22 ` Charles Forsyth
@ 2025-08-06 18:25 ` ori
2025-08-08 12:49 ` Bruce Ellis
2025-08-08 18:40 ` Bakul Shah via 9fans
2 siblings, 1 reply; 7+ messages in thread
From: ori @ 2025-08-06 18:25 UTC (permalink / raw)
To: 9fans
Quoth Anthony Sorace <a@9srv.net>:
> I've just run into awk code where yacc's default YYMAXDEPTH of 150 causes stack exhaustion; increasing it lets the code work fine. It's been 150 since at least v7 Unix (I didn't have earlier on hand to check), and our systems are a little bigger now; it seems safe to bump up quite a bit.
>
> Is anyone aware of yacc-generated code which uses this value as a check, rather than just being the more obvious guard against using too much system resources?
>
>
I don't think anything would notice. Do you have an example of code that causes an issue?
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Td74874a3700432ac-M977901863f799010b0447865
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] yacc's YYMAXDEPTH
2025-08-06 18:25 ` ori
@ 2025-08-08 12:49 ` Bruce Ellis
2025-08-08 18:04 ` Charles Forsyth
0 siblings, 1 reply; 7+ messages in thread
From: Bruce Ellis @ 2025-08-08 12:49 UTC (permalink / raw)
To: 9fans
[-- Attachment #1: Type: text/plain, Size: 1065 bytes --]
If you are blowing YYMAXDEPTH then you have a poor grammar specification.
Items : items item
Is good.
Items : item items
Is poor.
On Thu, 7 Aug 2025, 5:40 am , <ori@eigenstate.org> wrote:
> Quoth Anthony Sorace <a@9srv.net>:
> > I've just run into awk code where yacc's default YYMAXDEPTH of 150
> causes stack exhaustion; increasing it lets the code work fine. It's been
> 150 since at least v7 Unix (I didn't have earlier on hand to check), and
> our systems are a little bigger now; it seems safe to bump up quite a bit.
> >
> > Is anyone aware of yacc-generated code which uses this value as a check,
> rather than just being the more obvious guard against using too much system
> resources?
> >
> >
>
> I don't think anything would notice. Do you have an example of code that
> causes an issue?
>
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Td74874a3700432ac-M162a320121497030076cce59
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
[-- Attachment #2: Type: text/html, Size: 2598 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] yacc's YYMAXDEPTH
2025-08-08 12:49 ` Bruce Ellis
@ 2025-08-08 18:04 ` Charles Forsyth
2025-08-08 18:08 ` Charles Forsyth
0 siblings, 1 reply; 7+ messages in thread
From: Charles Forsyth @ 2025-08-08 18:04 UTC (permalink / raw)
To: 9fans
[-- Attachment #1: Type: text/plain, Size: 2060 bytes --]
That's indeed usually the case. it's amusing that top down hates left
recursion and bottom up hates right recursion (but it can cope), for
similar reasons, different ends of a mathematical equator.
Unfortunately I don't remember which thing failing prompted the
increase for the Limbo version, but I suspect it was nested parenthesised
expressions in a stress tester or similar,
where given ( e it wanted to wait for the punchline. /sys/src/cmd/cc/cc.h
defines YYMAXDEPTH to 1500 perhaps for a similar reason.
On Fri, 8 Aug 2025 at 16:28, Bruce Ellis <bruce.ellis@gmail.com> wrote:
> If you are blowing YYMAXDEPTH then you have a poor grammar specification.
>
> Items : items item
>
> Is good.
>
> Items : item items
>
> Is poor.
>
> On Thu, 7 Aug 2025, 5:40 am , <ori@eigenstate.org> wrote:
>
>> Quoth Anthony Sorace <a@9srv.net>:
>> > I've just run into awk code where yacc's default YYMAXDEPTH of 150
>> causes stack exhaustion; increasing it lets the code work fine. It's been
>> 150 since at least v7 Unix (I didn't have earlier on hand to check), and
>> our systems are a little bigger now; it seems safe to bump up quite a bit.
>> >
>> > Is anyone aware of yacc-generated code which uses this value as a
>> check, rather than just being the more obvious guard against using too much
>> system resources?
>> >
>> >
>>
>> I don't think anything would notice. Do you have an example of code that
>> causes an issue?
>>
> *9fans <https://9fans.topicbox.com/latest>* / 9fans / see discussions
> <https://9fans.topicbox.com/groups/9fans> + participants
> <https://9fans.topicbox.com/groups/9fans/members> + delivery options
> <https://9fans.topicbox.com/groups/9fans/subscription> Permalink
> <https://9fans.topicbox.com/groups/9fans/Td74874a3700432ac-M162a320121497030076cce59>
>
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Td74874a3700432ac-M468c4f01b70986c11457df8d
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
[-- Attachment #2: Type: text/html, Size: 3575 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] yacc's YYMAXDEPTH
2025-08-08 18:04 ` Charles Forsyth
@ 2025-08-08 18:08 ` Charles Forsyth
0 siblings, 0 replies; 7+ messages in thread
From: Charles Forsyth @ 2025-08-08 18:08 UTC (permalink / raw)
To: 9fans
[-- Attachment #1: Type: text/plain, Size: 2388 bytes --]
looking at /sys/src/cmd/cc/cc.h reminded me to note that in the app you can
#define YYMAXDEPTH before /sys/lib/yaccpar is copied in, and it #ifdefs the
YYMAXDEPTH value built into yacc
On Fri, 8 Aug 2025 at 19:04, Charles Forsyth <charles.forsyth@gmail.com>
wrote:
> That's indeed usually the case. it's amusing that top down hates left
> recursion and bottom up hates right recursion (but it can cope), for
> similar reasons, different ends of a mathematical equator.
> Unfortunately I don't remember which thing failing prompted the
> increase for the Limbo version, but I suspect it was nested parenthesised
> expressions in a stress tester or similar,
> where given ( e it wanted to wait for the punchline. /sys/src/cmd/cc/cc.h
> defines YYMAXDEPTH to 1500 perhaps for a similar reason.
>
>
> On Fri, 8 Aug 2025 at 16:28, Bruce Ellis <bruce.ellis@gmail.com> wrote:
>
>> If you are blowing YYMAXDEPTH then you have a poor grammar specification.
>>
>> Items : items item
>>
>> Is good.
>>
>> Items : item items
>>
>> Is poor.
>>
>> On Thu, 7 Aug 2025, 5:40 am , <ori@eigenstate.org> wrote:
>>
>>> Quoth Anthony Sorace <a@9srv.net>:
>>> > I've just run into awk code where yacc's default YYMAXDEPTH of 150
>>> causes stack exhaustion; increasing it lets the code work fine. It's been
>>> 150 since at least v7 Unix (I didn't have earlier on hand to check), and
>>> our systems are a little bigger now; it seems safe to bump up quite a bit.
>>> >
>>> > Is anyone aware of yacc-generated code which uses this value as a
>>> check, rather than just being the more obvious guard against using too much
>>> system resources?
>>> >
>>> >
>>>
>>> I don't think anything would notice. Do you have an example of code that
>>> causes an issue?
>>>
>> *9fans <https://9fans.topicbox.com/latest>* / 9fans / see discussions
>> <https://9fans.topicbox.com/groups/9fans> + participants
>> <https://9fans.topicbox.com/groups/9fans/members> + delivery options
>> <https://9fans.topicbox.com/groups/9fans/subscription> Permalink
>> <https://9fans.topicbox.com/groups/9fans/Td74874a3700432ac-M162a320121497030076cce59>
>>
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Td74874a3700432ac-M77e4373ad8702600bda0e1e4
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
[-- Attachment #2: Type: text/html, Size: 4155 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] yacc's YYMAXDEPTH
2025-08-06 14:31 [9fans] yacc's YYMAXDEPTH Anthony Sorace
2025-08-06 15:22 ` Charles Forsyth
2025-08-06 18:25 ` ori
@ 2025-08-08 18:40 ` Bakul Shah via 9fans
2 siblings, 0 replies; 7+ messages in thread
From: Bakul Shah via 9fans @ 2025-08-08 18:40 UTC (permalink / raw)
To: 9fans
Might be worth finding out exactly what is on the stack and what rules are being parsed when the stack overflows. Run yacc with -D1 or -D2 or something.
> On Aug 6, 2025, at 7:31 AM, Anthony Sorace <a@9srv.net> wrote:
>
> I've just run into awk code where yacc's default YYMAXDEPTH of 150 causes stack exhaustion; increasing it lets the code work fine. It's been 150 since at least v7 Unix (I didn't have earlier on hand to check), and our systems are a little bigger now; it seems safe to bump up quite a bit.
>
> Is anyone aware of yacc-generated code which uses this value as a check, rather than just being the more obvious guard against using too much system resources?
>
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Td74874a3700432ac-M73374e6d8c010ce750f3bcc6
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-08-08 18:51 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-06 14:31 [9fans] yacc's YYMAXDEPTH Anthony Sorace
2025-08-06 15:22 ` Charles Forsyth
2025-08-06 18:25 ` ori
2025-08-08 12:49 ` Bruce Ellis
2025-08-08 18:04 ` Charles Forsyth
2025-08-08 18:08 ` Charles Forsyth
2025-08-08 18:40 ` Bakul Shah via 9fans
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).