简体   繁体   中英

Is there any open source interpreter for JavaScript?

Is JavaScript an open source programming language? I want to know how some objects and methods work.

I mean, is the compiler, interpreter, or parser for JavaScript open source?

There are numerous open source JavaScript engines ( V8 , Rhino and SpiderMonkey spring to mind) as well as closed source implementations (I assume that whatever Opera and Microsoft use are not open source).

The language is fairly tightly based on the ECMAScript specification , which is freely available.

What do you mean by open source language?

JavaScript is interpreted by the browser and depends upon the vendor and developer which engine it uses. Some of the popular engines are listed in List of ECMAScript engines .

In addition to the answer given above, there is also an open source .NET implementation of JavaScript available: Its name is Jurassic , and it is available on CodePlex:

http://jurassic.codeplex.com/

Examples:

  1. Execute an expression:

    var engine = new Jurassic.ScriptEngine();

    Console.WriteLine(engine.Evaluate<int>("1.5 + 2.4"));

  2. Execute a script:

    var engine = new Jurassic.ScriptEngine();

    engine.ExecuteFile(@"c:\test.js");

Features of version 2.2 (taken from web site):

  • Supports all ECMAScript 3 and ECMAScript 5 functionality, including ES5 strict mode
  • Simple yet powerful API
  • Compiles JavaScript into .NET bytecode (CIL); not an interpreter
  • Deployed as a single .NET assembly (no native code)
  • Basic support for integrated debugging within Visual Studio
  • Uses light-weight code generation, so generated code is fully garbage collected
  • Tested on .NET 3.5, .NET 4 and Silverlight

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM