lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


You can take the Lua grammar definition at the end of the manual and put it into an LALR(1) parser generator like yacc and get it to generate a parser which just checks the syntax. It is almost LALR(1) and needs ony one small modification and a check function for it work. This is what I have done for Luerl.

Robert

----- Original Message -----
> > I have some large lua files.  I notice I could use lauxlib.h and
> > call luaL_loadstring, but that looks like it will use about as
> > much memory as the size of the lua file, which is undesirable.  I
> > don't need the output, I only need to check that it's valid lua.
> 
> Use luaL_loadfile and check its return code. Pop the result from the
> stack
> and the generated code will be collected eventually. But, no, there
> is no
> way to parse a Lua script without generating code.
> 
>