forked from cs-au-dk/TIP
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
168 changed files
with
5,357 additions
and
5,273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,9 @@ | ||
*.class | ||
*.log | ||
|
||
# sbt specific | ||
dist/* | ||
target/ | ||
lib_managed/ | ||
src_managed/ | ||
project/boot/ | ||
project/plugins/project/ | ||
|
||
# Scala-IDE specific | ||
.scala_dependencies | ||
|
||
#idea project files | ||
.idea/ | ||
.idea_modules/ | ||
/.cache | ||
|
||
# gradle eclipse files | ||
/.settings/ | ||
bin/ | ||
/.project | ||
/.classpath | ||
|
||
|
||
# gradle | ||
.gradle | ||
*.iml | ||
*.ipr | ||
*.iws | ||
build/ | ||
|
||
# compilation tmp file | ||
comp.out | ||
|
||
# tip out folder | ||
out/ | ||
.classpath | ||
.project | ||
.settings | ||
.idea/ | ||
/target | ||
/project | ||
.DS_Store |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
style = IntelliJ | ||
maxColumn = 150 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,10 @@ | ||
language: java | ||
language: scala | ||
scala: | ||
- 2.11.8 | ||
|
||
# whitelist | ||
branches: | ||
only: | ||
- master | ||
- devel | ||
- public-release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,102 @@ | ||
#TIP | ||
|
||
TIP is a tiny imperative programming language aimed at teaching the fundamental concepts of static program analysis. | ||
TIP is a tiny imperative programming language aimed at teaching the | ||
fundamental concepts of static program analysis. This code accompanies the | ||
lecture notes on [Static Program Analysis](http://cs.au.dk/~amoeller/spa/). | ||
|
||
[![Build Status](https://travis-ci.org/cs-au-dk/TIP.svg)](https://travis-ci.org/cs-au-dk/TIP) | ||
|
||
## Getting started | ||
|
||
Prerequisites: | ||
- Check you have [Scala 2.11](http://www.scala-lang.org/download/) installed | ||
- [Scala 2.11](http://www.scala-lang.org/download/) | ||
- [SBT](http://www.scala-sbt.org/) | ||
|
||
### Eclipse users | ||
We suggest you to use IntelliJ for working on TIP, but all the following | ||
options are viable. | ||
|
||
- Check that you have installed the [scala-plugin](http://scala-ide.org/) for eclipse | ||
- Run ```./gradlew eclipse``` (```gradlew eclipse``` on Windows) to generate the eclipse project files. | ||
- Now you should be able to open and build the project from eclipse. | ||
- To run tip from within eclipse feed the [arguments](#tipcmd) into the "Run Arguments" dialog | ||
### IntelliJ IDEA | ||
|
||
### IntelliJ IDEA users | ||
- Import the project from the SBT model. | ||
- Since the `.idea` folder is regenerated from scrach, in order to keep the | ||
inspection profiles you need to checkout the `.idea/inspectionProfiles` | ||
folder and the `.idea/codeStyleSettings.xml` file from the original repo, | ||
leaving untouched the other generated folders. | ||
- Follow the IDE instructions to download the Scala plugin and to set-up the | ||
Scala SDK, if needed. | ||
- Right-click on `Tip.scala` in `src/tip`, then select `Run 'Tip'`. To supply | ||
arguments, use `Edit Configurations` in the `Run` menu. | ||
|
||
- Import the project from the Gradle model | ||
- Since the ```.idea``` folder is regenerated from scrach, in order to keep the inspection profiles, you need to checkout the ```.idea/inspectionProfiles``` folder from this repo, leaving untouched the other generated folders | ||
- Follow the IDE instructions to download the Scala plugin and to set-up the Scala-SDK, if needed | ||
#### IntelliJ performance | ||
|
||
### Working from the terminal | ||
|
||
To build | ||
|
||
``` | ||
./gradlew build | ||
``` | ||
|
||
To build an executable | ||
If your IntelliJ has high-CPU and high-memory peaks while editing, the | ||
following tweaks might be useful: | ||
|
||
- Disable type-aware highlighting by clicking on the small `[T]` icon on the | ||
bottom right corner of the window. | ||
- Go to `Help -> Edit Custom VM Options` and increase the JVM memory at least | ||
with the following values: | ||
``` | ||
./gradlew installDist | ||
-Xms500m -Xmx1500m | ||
``` | ||
- If still nothing works, try `File -> Power Save Mode`. | ||
|
||
#### Build -> Run cycle | ||
#### IntelliJ Import optimization | ||
|
||
A wrapper ```tipw``` is provided to compile and run TIP with the given arguments. | ||
IntelliJ offers an option to optimize imports upon commit. We suggest not to | ||
use that feature, as it may remove needed imports thereby breaking | ||
compilation. | ||
|
||
## Command-line arguments <a name="tipcmd"></a> | ||
### Eclipse | ||
|
||
``` | ||
Usage: | ||
tip <options> <source> [out] | ||
- Check that you have installed the [scala-plugin](http://scala-ide.org/) for | ||
Eclipse. | ||
- To run TIP from within Eclipse, feed the [arguments](#tipcmd) into the `Run | ||
Arguments` dialog. | ||
|
||
<source> can be a file or a directory, | ||
### Working from the command-line | ||
|
||
[out] is an output directory (default: ./out) | ||
A wrapper command `tip` (`tip.bat` for Windows) is provided to compile and run | ||
TIP with the given arguments. | ||
|
||
possible options are: | ||
Example: | ||
``` | ||
./tip -types examples/a1.tip | ||
``` | ||
|
||
Analyses: | ||
To build: | ||
``` | ||
sbt compile | ||
``` | ||
|
||
-cfg construct the control flow graph, but do not perform any analysis | ||
-icfg construct the interprocedural control flow graph, but do not perform any analysis | ||
-types enable type analysis | ||
-cfa enable control-flow analysis | ||
-andersen enable Andersen pointer analysis | ||
-steensgaard enable Steensgaard pointer analysis | ||
-sign enable sign analysis | ||
-livevars enable live variables analysis | ||
-available enable available expressions analysis | ||
-vbusy enable very busy expressions analysis | ||
-reaching enable reaching definitions analysis | ||
-constprop enable constant propagation analysis | ||
-interval enable interval analysis | ||
## Command-line arguments <a name="tipcmd"></a> | ||
|
||
some of the previous options can be followed immediately by the modifiers | ||
Usage: | ||
``` | ||
tip <options> <source> [out] | ||
``` | ||
where `<source>` can be a file or a directory containing `.tip` files and | ||
`[out]` is an output directory (default: ./out). | ||
|
||
wl use the worklist solver | ||
wli use the worklist solver with init | ||
wliw use the worklist solver with init and widening | ||
wliwn use the worklist solver with init, widening, and narrowing | ||
wlip use the worklist solver with init and propagation | ||
iwli use the worklist solver with init, interprocedural version | ||
iwlip use the worklist solver with init and propagation, interprocedural version | ||
iwlic use the worklist solver with init, interprocedural version with CFA analysis | ||
To see the possible options, run `tip` without options. | ||
|
||
e.g. -sign wl will run the sign analysis using the basic worklist solver | ||
## Code style | ||
|
||
Running: | ||
To avoid using inconsistent code styles and meaningless diffs caused | ||
by IDE reformatting we use [scalafmt](https://olafurpg.github.io/scalafmt/). | ||
Before committing, please double-check that all the code is in the right | ||
format by executing `sbt scalafmt` or by installing the `scalafmt` IDE plugin | ||
and enabling the `Format on save` option as explained | ||
[here](https://olafurpg.github.io/scalafmt/#IntelliJ). | ||
|
||
-run run the program as the last step | ||
``` | ||
## Authors | ||
|
||
- Gianluca Mezzetti | ||
- [Gianluca Mezzetti](http://gmezzetti.name/) | ||
- [Anders Møller](http://cs.au.dk/~amoeller/) | ||
- Erik Krogh Kristensen | ||
- Christian Budde Christensen | ||
|
||
with contributions from | ||
|
||
- [Coen De Roover](http://soft.vub.ac.be/~cderoove/) | ||
- [Quentin Stievenart](http://awesom.eu/~acieroid/) | ||
- Erik Krogh Kristensen (interpreter) | ||
- Christian Budde Christensen (interpreter) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name := "tip" | ||
version := "2.0.0" | ||
|
||
scalaVersion := "2.11.8" | ||
|
||
trapExit := false | ||
|
||
scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature") | ||
|
||
libraryDependencies += "org.parboiled" %% "parboiled" % "2.1.3" | ||
libraryDependencies += "com.regblanc" % "scala-smtlib_2.11" % "0.2.1" | ||
libraryDependencies += "junit" % "junit" % "4.12" % "test" | ||
libraryDependencies += "org.scalatest" % "scalatest_2.11" % "3.0.0" | ||
|
||
scalaSource in Compile := baseDirectory.value / "src" | ||
scalaSource in Test := baseDirectory.value / "test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
map(l,f,z) { | ||
var r; | ||
if (l==null){ | ||
r=z; | ||
r=z; | ||
} else { | ||
r=(f)(map(*l,f,z)); | ||
r=(f)(map(*l,f,z)); | ||
} | ||
return r; | ||
} | ||
|
Oops, something went wrong.