开发者

Is there any open source interpreter for JavaScript?

开发者 https://www.devze.com 2023-03-22 22:05 出处:网络
Is JavaSc开发者_Python百科ript an open source programming language? I want to know how some objects and methods work.

Is JavaSc开发者_Python百科ript 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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号