Subj : Re: server-side compilation using spidermonkey To : wyl_lyf From : Brendan Eich Date : Thu Jan 06 2005 10:31 am wyl_lyf@yahoo.com wrote: > Hello! Good day! :) > > I would like to ask if its possible for spidermonkey to compile > javaascript embedded in a server response (i.e. > response.write(""...). It won't run or execute the script since > it will fail because there are objects that cannot resolve. It should > just check for javascript syntax errors inside the (). > any ideas? thanks! Sure, you can check syntax with JS_BufferIsCompilableUnit (see http://lxr.mozilla.org/mozilla/source/js/src/jsapi.h). Checking syntax is less interesting for many cases than run-time checking, or some optimistic static analysis that hasn't bee done to my knowledge, but if you just want syntax checking, that's easy. /be .