This page is likely outdated (last edited on 10 Feb 2008). Visit the new documentation for updated content.
JScript
JScript.NET compiler is not currently supported in Mono
There is no active maintainer, and there is no active development on it. Chances are that we will focus on a new Javascript implementation based on the DLR in the future, but there are no news at this point
Table of contents |
Introduction
Mono’s support for JScript .NET is no longer under development
Originally, we were targeting the ECMAScript language specification published by Ecma Internationalin the standard ECMA-262.
The JScript’s support it’s divided in two areas:
- Compiler.
- Runtime support.
Status
We are using Mozilla’s JavaScript test suite with some small modifications and a custom runner for testing. It can be found at directory mcs/class/Microsoft.JScript/Test/Mozilla.
The results are: 8640 successful tests out of 8917 (96.89%).
Future Plans
We are working toward being full ECMAScript-262 compliant at compiler and runtime level. But also we want to include MS proposed extensions for ECMAScript4:
Enumerations: http://msdn2.microsoft.com/en-us/library/y94acxy2.aspx
Constants: http://msdn2.microsoft.com/en-us/library/7t07247t.aspx
Class based object oriented programming:
class declaration: http://msdn2.microsoft.com/en-us/library/ezts5hx6.aspx
interface declaration: http://msdn2.microsoft.com/en-us/library/h30d6hy0.aspx
function_get: http://msdn2.microsoft.com/en-us/library/77kz8hy0.aspx
function_set: http://msdn2.microsoft.com/en-us/library/6ysbstsx.aspx
static statement: http://msdn2.microsoft.com/en-us/library/7k208hb5.aspx
expando modifier: http://msdn2.microsoft.com/en-us/library/ch149y3b.aspx
super modifier: http://msdn2.microsoft.com/en-us/library/f3cbk963.aspx
public modifier: http://msdn2.microsoft.com/en-us/library/0cs1ax5t.aspx
private modifier: http://msdn2.microsoft.com/en-us/library/52zye4wa.aspx
protected modifier: http://msdn2.microsoft.com/en-us/library/x35feb9t.aspx
internal modifier: http://msdn2.microsoft.com/en-us/library/ah1b9xxb.aspx
abstract modifier: http://msdn2.microsoft.com/en-us/library/a2fb5y72.aspx
final modifier: http://msdn2.microsoft.com/en-us/library/47ezsw2s.aspx
hide modifier: http://msdn2.microsoft.com/en-us/library/1k022k51.aspx
override modifier: http://msdn2.microsoft.com/en-us/library/2wte5sx9.aspx
static modifier: http://msdn2.microsoft.com/en-us/library/f4ewhdb8.aspx
Conditional compilation.
@cc_on: http://msdn2.microsoft.com/en-us/library/eb0w91wa.aspx
@if and friends: http://msdn2.microsoft.com/en-us/library/ct27x3xa.aspx
@set: http://msdn2.microsoft.com/en-us/library/k0h7dyd7.aspx
@debug: http://msdn2.microsoft.com/en-us/library/2a464tzs.aspx
@position: http://msdn2.microsoft.com/en-us/library/1fkt8wb5.aspx
Conditional compilation variables: http://msdn2.microsoft.com/en-us/library/7142yyxw(VS.80).aspx
But that should not stop you from implementing new cool features like:
- E4X support (ECMAScript for XML).
- Continuations support.
- Access to Mono’s base class library.
- Implement a MonoDevelop add-in, which should include an interactive shell.
- Emit debug info.
- Microsoft extensions like typed variables.
Working with mjs
How to get the compiler
Mono’s JScript compiler is part of the ‘mcs’ module and is built by default, it’s distributed under the name of mjs.
How mjs is implemented
Mono’s JScript compiler is written in C#, and it’s constructed under the standard compiler architecture, which means that it is separated into phases. The current phases are tokenizing, parsing, semantic analysis and code generation.
We use a handcoded tokenizer and parser which was ported from Mozilla’s Rhino compiler, after that we build an abstract syntax tree which is used by the semantic analyser and code generator for context analysis and the generation of the CIL image, respectively. mjs uses .NET’s System.Reflection.Emit API for code generation which makes it much more understandable and readable.
How to contribute
There are a number of ways to contribute to the JScript effort. They range from reporting bugs in mjs and Microsoft.JScript.dll, implementing JScript’s object system classes as well as the embedded runtime support which involves the implementation of classes related to VsaEngine; those classes are located in the mcs/class/Microsoft.JScript directory.
Currently, the best way of contributing is to have a look at the failing tests in mcs/class/Microsoft.JScript/Test/Mozilla and fix them. Detailed instructions for how to use the test suite are in the README of that directory.
If you need specific details don’t hesitate to send an e-mail to cesar or the mono-devel mailing list. If you have questions about the run time you can also try contacting flgr for help.
If you are generally interested in the project you might also want to join the developers at #mjs on irc.gimp.org.
Submitting bug reports
mjs has its own query module and also you can add more reports. Take a look at Mono’s good practices for creating a bug report