PDA

View Full Version : is there a program to make exe files from javascript?


Tails
05-17-2003, 07:26 PM
I want to convert javascript programs into executables. Is there a program that will work with javascript as a language? I have heard that there were programs to make batch files into com files. Javascript should be the same except for the browser's gui. Sounds like a good testing idea, right?

liorean
05-17-2003, 08:36 PM
Well, there exists KJS (KDE's JavaScript engine), SpiderMonkey (Mozilla's C JavaScript engine), Rhino (Mozilla's Java JavaScript Engine), Windows Scripting Host (JScript engine). I believe none of these are coupled with a compiler. As for the other commersial engines (OmniGroup, iCab, Opera, Sun) I don't think they even have standalone runtimes.

So, I don't think there's a way to compile JavaScript yet. There might appear a -->C or -->Java bytecode compiler with the ECMAScript 2 standard (ECMA-262 Ed4 when released), but I doubt there will appear a -->machine code compiler. JavaScript isn't made in a way that encourages compiling the program. You'd need to bring a lot of the runtime into the executable anyway, since JavaScript is not only dynamically typed, but also dynamically bound and scoped.



But, don't let that let you down. You can always make a JS that uses WSH or Rhino (with LiveConnect to Java for IO, among other things) for doing out-of-browser scripting.


It could be that JScript.NET has a compiler. I don't know anything about that environment/platform.


(I forgot to mention Epimetheus, Mozilla's C engine for JavaScript 2 ~= ECMAScript 2)

Tails
05-17-2003, 08:46 PM
I wanted to know this because learning C++ is not within my budget and no good compilers exist that I have seen for free.

liorean
05-18-2003, 06:04 AM
Oh, there exists a couple of good both compilers and linkers. It's in the area of development tools they are lacking - in other word, the compiler and linker are the only things that are both good and free. If you want a debugger, a syntax checker, a pretty printer, a GUI development and project management facility, those exists too, but you can only get so many for each use. If all you need is the compiler/linker, you could write in a text editor and use one of several CLI compiler/linker sets.

jalarie
05-22-2003, 04:15 PM
liorean, could you expand upon the Windows Scripting Host or provide a link? I had something at one time, tried a couple things, took a break to do other things, lost the link, and had not bothered to document what I was doing well enough to get back to where I'd stopped. Thank you for any help you might offer.

swmr
05-22-2003, 04:47 PM
info related to wsh:

This site (http://www.interclasse.com/links/index.php) has a long list o' links...

Tails
05-22-2003, 05:28 PM
I would really like to get familiar with the syntax of the format rather than a compiler-specific tutorial. And all compilers would be able to read this "standard" syntax format, so who could go wrong with that? All the tutorials I find are for Visual Basic C++.

liorean
05-23-2003, 12:20 AM
Visual Basic C++ doesn't exist.
In Visual Studio, you have Visual C++ and Visual Basic, though.

Most tutorials are on VCPP, though, you are right on that. The standard is ANSI, though, and if you search for ANSI C and have a look at the other large compiler, GCC (docs for unix/linux mostly, some MingW32, Cygwin) you will find what is "standard". You'll soon find that even if you use the standard, however, all implementations are unique and differs from the standard in different way, so you will have to tweak it to that implementation anyway. Mozilla and others use lots of IFDEFs and the like in their source to get around the problems by somewhat different implementations.

This is getting off-topic, though. Maybe should be moved to Computer Programming?

Tails
05-24-2003, 03:09 PM
I don't think they would care I once posted in the Computer programming area and I never gotten a reply. It's probably the very last and least replied topic in that forum. If you can get me in there with a recommendation, that would help. Such snobs expect people to have an invitation. The CGI forum was the same too. I have nothing but dumb questions because I don't know how to start out. I'll have good questions if I can get past that.