meta icon indicating copy to clipboard operation
meta copied to clipboard

Use stack with indices and loop to avoid stack overflow

Open bvssvni opened this issue 8 years ago • 1 comments
trafficstars

Currently, when a rule call itself recursively, it leads to stack overflow.

bvssvni avatar Jan 11 '17 14:01 bvssvni

IIRC yacc has some way around this that requires you to write recursive rules backwards. I.e.

foos = [foos foo]

instead of

foos = [foo foos]

I'm not sure if their trick is still possible to use if your grammars aren't LR(1) or whatever... but maybe a place to draw inspiration from.

epurdy avatar May 20 '18 00:05 epurdy