#TIP
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.
Prerequisites:
We suggest you to use IntelliJ for working on TIP, but all the following options are viable.
- Install the Scala end the SBT plugins in IntelliJ.
- 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
insrc/tip
, then selectRun 'Tip'
. To supply arguments, useEdit Configurations
in theRun
menu.
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:
-Xms500m -Xmx1500m
- If still nothing works, try
File -> Power Save Mode
.
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.
- Check that you have installed the scala-plugin for Eclipse.
- To run TIP from within Eclipse, feed the arguments into the
Run Arguments
dialog.
A wrapper command tip
(tip.bat
for Windows) is provided to compile and run
TIP with the given arguments.
Example:
./tip -types examples/a1.tip
To build:
sbt compile
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).
To see the possible options, run tip
without options.
To avoid using inconsistent code styles and meaningless diffs caused
by IDE reformatting we use 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.
with contributions from
- Coen De Roover
- Quentin Stievenart
- Erik Krogh Kristensen (interpreter)
- Christian Budde Christensen (interpreter)