gecko-dev/js2/jsc
..
build/java
macbuild
src/java
test
readme

J S C   R E A D M E   F I L E
Jeff Dyer, Mountain View Compiler Company
Jan-26-2001

OVERVIEW

JSC (JavaScript Compiler) is a stand-alone front-end implementation
of the JS2 language specification. Its purpose is to demonstrate how
JS2 programs are statically prepared for execution by a JS2 interpreter. 
Its output is assembly code that is assembled by the JS engine.

BUILDING JSC

Before you start make sure you have a current version of the Java SDK
installed on your system. If it is correctly installed, you can type
'javac' at the command-line and see something like:

	Usage: javac <options> <source files>

followed by a bunch of other documentation text.

NOTE: I've only tried to build on NT40 using Java2 1.3.0_01. You may
get different results in different environments. 

Go to the directory ./build/java, and run your favorite make
utility, such as:

	make

If all goes well, the sanity test will run and you will see something
like

	../../test/sanity.js: 0 errors [120 msec]

on the last line of the console output. To run more extensive tests, 
use the build command:

	make test

There are also build targets for each of the components (input, lexer,
parser, semantics, and generator) of the compiler. Thus, a useful idiom
is to give 'make' two targets, the component you just modified followed
by the sanity test target like this:

	make parser sanity

To automatically rebuild the parser and run the sanity test. What's
missing is any kind of dependency rules, so using the root target 
always rebuilds everything. This, for the sake of keeping it simple.


RUNNING JSC

From the ./build/java directory, use the following command:

	java -classpath classes Main program.js

where 'program.js' is the name of the file to compile. JSC will
produce a new file given the name of the original source file
with the suffix '.jsil' appended to it. Errors are written to a 
file with the suffix '.err' appended to it.

CHANGES

Jan-26-2001
-----------
Added first cut at xml icode generation. In particular function definitions,
call and binary expressions are implemented. Object and array literals are
also implemented. Many of the tests used for verifying the parser and semantic
analyzer, are not yet working.

Dec-15-2000
-----------
Removed dependency on sun.tools packages.

Dec-1-2000
----------
* Original checkin to mozilla.org. 
* Updated readme. 
* NPL copyright notice added to all source files.

Nov-30-2000
-----------
* Folded definition evaluation into constant evaluation since annotated
  definitions cannot be evaluated until the constant attribute values
  have been computed. Now there is a BlockEvaluator and a ConstantEvaluator.
* Added an error handler to the constant evaluator.
* Simplified the type system.

Nov-16-2000
-----------
* Original release.