Coder Social home page Coder Social logo

jsai-romanenko's Introduction

JSAI: JavaScript Abstract Interpreter

NOTE: This is a clone of the source code for the paper "JSAI: A Static Analysis Platform for JavaScript" (FSE'14). Downloaded from the UCSB PL Lab.

I've updated the Scala and SBT versions and removed WithRewriter.jar from the unmanagedJars (this prevents dependency problems in other projects of mine.

--nystrom

The document notjs.pdf contains the formal specification of the notJS IR, its concrete and abstract semantics. This document references builtin.pdf. The document translation.pdf contains formalisms for translation from JavaScript to notJS and the document proof-sketches.pdf contains proof sketches for the object abstract domain.

Installation

In order to install and run the analysis, you will need:

  1. sbt version 0.13.15.
  2. Scala version 2.12.2.

Building

To build the project:

  1. Do a clean
$ sbt clean
  1. Do a build
$ sbt compile

Running

To run the concrete interpreter:

$ sbt "run-main notjs.concrete.interpreter.notJS <JavaScript file name> <options>"

The different options to the concrete interpreter are:

  1. --print: This will print out the argument provided to the print() calls in the provided JavaScript file.
  2. --testing: This is used for testing concrete interpreter with the abstract interpreter.
  3. --catchexc: This will reduce clutter in output produced due to exceptions thrown.
  4. --printid: This will print out the argument provided to the print calls, along with the ids of the print statements, helpful to debug along with abstract interpreter output.

To run the abstract interpreter:

$ sbt "run-main notjs.abstracted.interpreter.notJS <JavaScript file name> <options>"

The different options to the abstract interpreter are:

  1. --lightgc: Perform lightweight gc.
  2. --fullgc: Perform full gc.
  3. --prune: Perform store pruning.
  4. --testing: To be provided when tested against the concrete interpreter.
  5. --print: This will print out the argument provided to the print() calls in the provided JavaScript file.
  6. --catchexc: This will reduce clutter in output produced due to exceptions thrown.
  7. --timeout=: This is used to provide a timeout (in seconds), if the abstract interpreter takes more than the specified timeout, an exception is thrown.
  8. --trace=: This is used to provide various traces. Consult src/main/scala/abstract/interpreter.scala for available traces.

More options can be seen from src/main/scala/abstract/interpreter.scala.

Note: if the JavaScript file has with construct, please use the with rewriter in lib/WithRewriter.jar (java -jar WithRewriter.jar [inputfile name] [outputfile name]). All credits to the rewriter go to Programming Language Research Group @KAIST (http://plrg.kaist.ac.kr/research/software).

Running the tests

To run the simple abstract tests:

$ sbt "test-only notjs.tester.abstracted.SimpleTests"

To run the simple abstract tests with various options:

$ sbt "test-only notjs.tester.abstracted.SimpleTestsWithOptions"

To run the simple abstract tests with various traces:

$ sbt "test-only notjs.tester.abstracted.SimpleTestsWithTraces"

To run the Sun Spider tests (by default, the options are --prune and trace=stack-1-0:

$ sbt "test-only notjs.tester.abstracted.SunSpiderTests"

Running pretty printers

To run the text pretty printer:

$ sbt "run-main notjs.syntax.TextPrint <js file> <output file> --debug"

To run the code pretty printer:

$ sbt "run-main notjs.syntax.CodePrint <js file> <output file> --debug"

To run the dotty pretty printer:

$ sbt "run-main notjs.syntax.DotPrint <js file> <output file> --debug"

Each of these can also be run without the --debug flag, that does not treat calls to print specially.

jsai-romanenko's People

Contributors

nystrom avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.