Commit 66539fc8 authored by jeff.dyer%compilercompany.com's avatar jeff.dyer%compilercompany.com
Browse files

First cut a xml code generation.

parent 1d926262
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -27,7 +27,11 @@ generator:
	javac -d classes -classpath classes ../../src/java/generator/*.java 

sanity:
	java -classpath classes Main -d ../../test/sanity.js
	java -classpath classes Main -a ../../test/sanity.js

testgen:
	java -classpath classes Main -d ../../test/ecma-e4/02.expressions/primary.1.js
	java -classpath classes Main -d ../../test/ecma-e4/06.functions/function.1.js

test:
	java -classpath classes Main -d ../../test/ecma-e4/02.expressions/primary.1.js
@@ -49,3 +53,7 @@ test:
	java -classpath classes Main -d ../../test/ecma-e4/03.statements/with.1.js
	java -classpath classes Main -d ../../test/ecma-e4/04.definitions/definition.1.js
	java -classpath classes Main -d ../../test/ecma-e4/04.definitions/definition.2.js

test_functions:
	java -classpath classes Main -debug -asm ../../test/ecma-e4/06.functions/function.1.js
+10 −18
Original line number Diff line number Diff line
J S C   R E A D M E   F I L E
Jeff Dyer, Mountain View Compiler Company
Dec-15-2000
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 a psuedo intermediate language suitable for reading by
human beings.
Its output is assembly code that is assembled by the JS engine.

BUILDING JSC

@@ -31,7 +30,7 @@ utility, such as:
If all goes well, the sanity test will run and you will see something
like

	../../test/sanity.js: 0 errors [120 msec] --> completion( 0, okay, null )
	../../test/sanity.js: 0 errors [120 msec]

on the last line of the console output. To run more extensive tests, 
use the build command:
@@ -61,22 +60,15 @@ 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.


STATUS OF JSC

Dec-1-2000
----------
Signficant portions of the type system, compile-time constant evaluator,
and name management systems are working. Missing are semantics for 
using, import, export, and unit parsing. More tests are also needed.


ISSUES

* Intermediate form of references, classes, and interfaces.

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.
+1180 −623

File changed.

Preview size limit exceeded, changes collapsed.

+9 −6
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ public class Main {
	private static boolean traceInput  = false;
    private static boolean traceLexer  = false;
	private static boolean traceParser = false;
	private static boolean doASM       = false;
	private static boolean debug       = false;


@@ -67,6 +68,8 @@ public class Main {
				traceParser = true;
			} else if (args[i].equals("-d")||args[i].equals("-debug")) {
				debug = true;
			} else if (args[i].equals("-a")||args[i].equals("-asm")) {
				doASM = true;
			} else if (args[i].charAt(0) == '-') {
				System.out.println("Unknown.option "+ args[i]);
			} else {
@@ -148,7 +151,7 @@ public class Main {
					if( traceParser ) {
						Debugger.trace("setting parser output to " + input[i]);
						JSILGenerator.setOut( input[i]+".par" );
						node.evaluate(context,new JSILGenerator());
						node.evaluate(context,new JSILGenerator(false));
					}

					//Evaluator evaluator;
@@ -157,14 +160,14 @@ public class Main {
					context.setEvaluator(new BlockEvaluator());
					node.evaluate(context, context.getEvaluator());

					JSILGenerator.setOut( input[i]+".blocks" );
					context.setEvaluator(new JSILGenerator());
					node.evaluate(context, context.getEvaluator());
					//JSILGenerator.setOut( input[i]+".blocks" );
					//context.setEvaluator(new JSILGenerator(false));
					//node.evaluate(context, context.getEvaluator());

					context.setEvaluator(new ConstantEvaluator());
					value = node.evaluate(context, context.getEvaluator());

					context.setEvaluator(new JSILGenerator());
					context.setEvaluator(new JSILGenerator(doASM));
					JSILGenerator.setOut( input[i]+".jsil" );
					node.evaluate(context, context.getEvaluator());
					errorCount = context.errorCount();
@@ -172,7 +175,7 @@ public class Main {

	            t = System.currentTimeMillis() - t;
                //Debugger.trace(""+global);
                System.out.println(input[i] + ": "+ errorCount +" errors [" + Long.toString(t) + " msec] --> " + value.getValue(context) );
                System.out.println(input[i] + ": "+ errorCount +" errors [" + Long.toString(t) + " msec]");

            } catch( Exception x ) {
                x.printStackTrace();
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ public class Node {

    Block block;
    int position;
	Store store;

    public Node() {
    }
Loading