lua-users home
lua-l archive

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



> On 27-Aug-04, at 1:46 PM, Nick Trout wrote:
> > I'm just looking at adding better static analysis of Lua
> > now.
> 
> What did you have in mind? I'm happy to add stuff, time permitting

Ahhh. Well, some sort of mechanism so I can give the parser a script and
perhaps, optionally, a list of registered constants and functions (e.g.
that are C registered); then parser returns a list of syntax errors that
I can deal with, just like a regular C compiler. Perhaps it returns a
table of tables containing error type, description, line number, source
file etc. This may be tricky because with Lua's first class function
objects, functions could be reassigned and the code is correct. This is
one of the problems of performing static analysis on a dynamic language.

Currently we use luac to compile code and this catches a lot of errors,
but it won't catch some runtime problems (like misspelling of exported
function names and variables etc). We have coloured syntax highlighting,
so provided constants and functions are registered they'll be a
different colour but it would still be nice to give compilation errors. 

Basically I'm just try to catch as many errors as possible before Lua
executes in its target environment.

Nick