Skip to content Skip to sidebar Skip to footer

Javascript: Standalone Compiler Or Interpreter For Windows?

What are the JavaScript compilers or interpreters available for Windows? I read the book Eloquent JavaScript recently. This book introduces the reader to programming using JavaScri

Solution 1:

Nobody has mentioned yet, window's own javascript compiler: http://msdn.microsoft.com/en-us/library/vstudio/7435xtz6(v=vs.100).aspx

Microsoft (R) JScript Compiler version 8.00.50727
for Microsoft (R) .NET Framework version 2.0.50727
Copyright (C) Microsoft Corporation 1996-2005. All rights reserved.

jsc [options] <source files> [[options] <source files>...]

                         JScript Compiler Options

                           - OUTPUT FILES -
  /out:<file>              Specify name of binary output file
  /t[arget]:exe            Create a console application (default)
  /t[arget]:winexe         Create a windows application
  /t[arget]:library        Create a library assembly
  /platform:<platform>     Limit which platforms this code can run on; must be x86, Itanium, x64, or anycpu, which is the default

                           - INPUT FILES -
  /autoref[+|-]            Automatically reference assemblies based on imported namespaces and fully-qualified names (on by default)
  /lib:<path>              Specify additional directories to search infor references
  /r[eference]:<file list> Reference metadata from the specified assembly file
                           <file list>: <assembly name>[;<assembly name>...]

                           - RESOURCES -
  /win32res:<file>         Specifies Win32 resource file (.res)
  /res[ource]:<info>       Embeds the specified resource
                           <info>: <filename>[,<name>[,public|private]]
  /linkres[ource]:<info>   Links the specified resource to this assembly
                           <info>: <filename>[,<name>[,public|private]]

                           - CODE GENERATION -
  /debug[+|-]              Emit debugging information
  /fast[+|-]               Disable language features to allow better code generation
  /warnaserror[+|-]        Treat warnings as errors
  /w[arn]:<level>          Set warning level (0-4)

                           - MISCELLANEOUS -
  @<filename>              Read response file for more options
  /?                       Display help
  /help                    Display help
  /d[efine]:<symbols>      Define conditional compilation symbol(s)
  /nologo                  Do not display compiler copyright banner
  /print[+|-]              Provide print() function

                           - ADVANCED -
  /codepage:<id>           Use the specified code page ID to open source files
  /lcid:<id>               Use the specified LCID for messages and default code page
  /nostdlib[+|-]           Do not import standard library (mscorlib.dll) and change autoref default to off
  /utf8output[+|-]         Emit compiler output in UTF-8 character encoding
  /versionsafe[+|-]        Specify default for members not marked 'override' or 'hide'

There are usually a couple of copies lying around on any windows install, but they are not usually in the path, so you have to find them.

The compiler is capable of compiling javascript files into executables that can run on any windows machine with .NET installed.

Solution 2:

Node.js works well as an interpreter, even if you do not choose to use it for web applications. It is a framework that runs on the V8 JavaScript engine. It is well documented with a large selection of official and third party modules.

It does require cygwin to run on Windows though (or you can compile it with MingW). There are precompiled binaries, including the required cygwin libraries, available at node-js.prcn.co.cc.

Solution 3:

There are several free standalone Javascript interpreters available:

  1. V8 - This is the same Javascript engine used in the Chrome browser.
  2. SpiderMonkey - From Mozilla.
  3. Rhino - A Javascript implementation on Java.

Solution 4:

jsdb is nice. I use it within editplus, sometimes within Aptana Studio

Solution 5:

Ok, Windows Scripting Host is tool for performing various administrative tasks using Microsoft's Active Scripting and can run scripts in various languages, including JScript, their ECMAScript implementation. There is no much else to say about it, so point your browser to the reference - http://msdn.microsoft.com/en-us/library/shzd7dy4(VS.85).aspx

Forget about compiler, BTW, ECMAScript is interpreted language (JIT compiling is the other issue)

Also, note that ECMAScript standard does not define any standard I/O, so the host program is responsible for providing it.

Post a Comment for "Javascript: Standalone Compiler Or Interpreter For Windows?"