https://github.com/jacksongl/semanticdiff
A project aimed at detecting inconsistency among semantic-preserving code transformations for JavaScript.
https://github.com/jacksongl/semanticdiff
Last synced: 11 months ago
JSON representation
A project aimed at detecting inconsistency among semantic-preserving code transformations for JavaScript.
- Host: GitHub
- URL: https://github.com/jacksongl/semanticdiff
- Owner: JacksonGL
- Created: 2015-02-17T02:40:49.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-04-06T05:19:05.000Z (about 11 years ago)
- Last Synced: 2025-03-31T04:18:07.534Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 8.43 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SemanticDiff
A research project aimed at detecting inconsistency among semantic-preserving code transformations for JavaScript.
This repository currently has been tested on Mac OS.
Install
-------------------------
To run SemanticDiff you need to install jalangi2 first.
Install jalangi2
-------------------------
See the Jalangi2 Repository here:
https://github.com/Samsung/jalangi2
Install some node.js packages:
-------------------------
```
npm install acorn
npm install escodegen
npm install promise
npm install argparse
npm install esotope
npm install jsdom@3.1.2
npm install qunit
npm install phantom
npm install phantomjs -g
```
Run SemanticDiff on node.js
-------------------------
The last argument specifies the target JavaScript program to be analysed.
```
node ../jalangi2/src/js/commands/jalangi.js --inlineIID --inlineSource --analysis ../jalangi2/src/js/sample_analyses/ChainedAnalysesNoCheck.js --analysis src/js/analyses/lib/Utils.js --analysis src/js/analyses/traceRecorder.js tests/tiny_tests/test1.js
```
Use SemanticDiff to detect inconsistency on simple JS minimization:
-------------------------
The last argument specifies the target JavaScript program to be analysed.
```
./script/genTrace.sh
```
Use of the Google Closure Compiler
-------------------------
```
java -jar thirdParty/closure/compiler.jar --compilation_level WHITESPACE_ONLY --js_output_file tests/tiny_tests/regexp_min.js tests/tiny_tests/regexp.js
```
Useful Resources
-------------------------
Debugging JavaScript with SourceMap
https://developer.chrome.com/devtools/docs/javascript-debugging
Events to be observed by SemanticDiff
-------------------------
* write to global variable
* putField on objects accessable from global name space
* console
* ajax
* alert
* modify dom
Things that could make minimization to go wrong
-------------------------
* use of ```eval```
* statement without semicolon at the end
Also need to handle the ```math.random``` function
Resouces concerning the Google Closure Compiler
-------------------------
[Compiler Assumptions](https://github.com/google/closure-compiler/wiki/Compiler-Assumptions)