The Lua parser: recursive?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The Lua parser: recursive?

Reuben Thomas-3
Is the built-in Lua parser recursive descent? The reason I ask is that I ran
into trouble with my EPOC port with it running out of stack space (stack
size 8Kb) on a very small (incorrect) program:

function f() local f = function() x end end

(x is not defined)

My port can parse moderately-sized programs with no trouble; the problem
seems to be that when an error is detected like this, a lot of nested
function calls are made, several of which have fairly large stack frames.

I suppose that for the execution of Lua programs, 4.1's stacklessness will
help me, but will the parser change?

For now, I've just bumped the stack up to 16Kb; I'm not sure what is really
needed (any hints?).

-- 
http://sc3d.org/rrt/
L'art des vers est de transformer en beautés les faiblesses (Aragon)


Reply | Threaded
Open this post in threaded view
|

Re: The Lua parser: recursive?

Luiz Henrique de Figueiredo
>Is the built-in Lua parser recursive descent?

Yes, except that expressions are parsed with priorities too.

>My port can parse moderately-sized programs with no trouble; the problem
>seems to be that when an error is detected like this, a lot of nested
>function calls are made, several of which have fairly large stack frames.

You might try to reduce the number of locals and things like that in llimits.h.

>I suppose that for the execution of Lua programs, 4.1's stacklessness will
>help me, but will the parser change?

I think it's likely that the parser structure will not change as a whole,,
but perhaps something can be done about the large stack frames.
--lhf