Subj : Re: server-side compilation using spidermonkey To : netscape.public.mozilla.jseng From : wyl_lyf Date : Thu Jan 06 2005 11:24 am Hello, thanks for the information. It would be nice to execute the script in runtime. But I'm not sure how to do this without running apache or opening the browser. Example: Given that I only have a javascript with the response.write (".."). So I will have to create a program that links with spidermonkey libraries pass it my javascript server response and it will be able to check syntax and compile? is this correct? many thanks! Brendan Eich wrote: > 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 .