This source bundle contains two directories:

TypedJS/
ML-LambdaJS/

The code relevant to this submission is in TypedJS/, but depends on
ML-LambdaJS.  ML-LambdaJS is also available on github at:

https://github.com/arjunguha/ML-LambdaJS

----------------------------------------------------------------------
DEPENDENCIES
----------------------------------------------------------------------

OCaml 3.11.1
Rhino >= 1.7 ( For running jslint.js )

To build:

cd TypedJS/src
./build.sh

----------------------------------------------------------------------
THINGS TO EXECUTE
----------------------------------------------------------------------

Interesting commands:

./tca <javascript_file>

Runs the type-checker on the file with the browser environment ADsafe
expects.  e.g. ./tca adsafe/src/typed-adsafe.js

./tca -lint <javascript_file>

Annotates the file with upcasts to the Widget type and type-checks it
in the ADsafe browser environment.

./tca -lint -expr <javascript_file>

This is a debugging option that will show the (partially desugared)
file with annotations added.

./tests/lint/test-lint.sh

This will run jslint and our type checker on a series of test cases
and report differences (see tests/lint below)

----------------------------------------------------------------------
TESTS
----------------------------------------------------------------------

tests/typable
tests/untypable
tests/browser
tests/gadgets

These include test cases for the type system in general, along with
its model of the browser.

----------------------------------------------------------------------

tests/lint/untypable
tests/lint/typable

The first includes test cases that JSlint (with the ADsafe option on)
rejects, and our type system rejects as well.  The second includes
test cases that type-check, and JSlint may or may not accept.  For
example, JSlint rejects a switch statement because of a lint-like
check, but we can type-check it.  These tests include ~1000 LOC of
sample widgets that we successfully type-check.


----------------------------------------------------------------------

tests/adsafe-bugs

This directory holds the essence of some of the bugs that were found
both by us and by others.  They can be run by ./tcbug <filename> to
see interesting type errors.  Since the resulting errors report the
Widget type which is quite large, you may want to redirect stdout to a
file for viewing.


----------------------------------------------------------------------
ADSAFE
----------------------------------------------------------------------

adsafe/src/adsafe-javascript.env
adsafe/src/adsafe-browser.env
adsafe/src/adsafe.env

These files make up the environment that is used to type-check
adsafe.js and model the environment of widgets.  The file adsafe.env
contains the specification of the Widget type described in the paper,
along with a number of other type aliases used in type-checking
ADsafe.

----------------------------------------------------------------------

adsafe/src/typed-adsafe.js

This contains the annotated source of adsafe.js that we feed to our
type-checker.
