wytseoortwijn edited this page May 8, 2018 · 56 revisions

This document gives instructions on how to configure and use VerCors.

Configuring VerCors for Eclipse

First make sure that Eclipse is installed. The installation instructions described below have been tested with Oxygen, release version 4.7.3a (April 2018). Also make sure that VerCors has been installed according to the instructions given on the main Git page.

Configuring the VerCors modules

  1. Install the Scala IDE plugin for Eclipse. Download- and installation instructions can be found here. After providing the installation/update site in Eclipse, make sure that all the suggested options are selected for installation.
  2. Perform a command-line build of VerCors: open a terminal, change the directory to the root directory of VerCors and do ant clean, followed by ant. Please check for build errors afterwards; the build was probably unsuccessful if you see any errors, even though Ant may still give the verdict "build successful".
  3. In Eclipse, create a new Java project (File > New > Java Project) with project name "HRE", and instead of using the default location, click "Browse..." and select the ./hre subdirectory of your VerCors build.
  4. Create another new Java project with project name "Viper API" and instead of using the default location, click "Browse..." and select the ./viper/viper-api subdirectory of your VerCors build.
  5. Create another Java project with project name "VCT parsers" and select the ./parsers subdirectory of your VerCors build as its location.
  6. Create another Java project with project name "VCT main" and select the ./vercors subdirectory of your VerCors build. After creating the project, add a Scala-nature to the project: "Right-click on VCT main > Configure > Add Scala Nature". If Eclipse complains about incompatible Scala versions, try to change the version of the Scala nature and see if that resolves the incompatibility errors. After doing this, add the projects "HRE", "Viper API" and "VCT parsers" as dependencies to the "VCT main" project. To do this, go to the properties of the "VCT main" project, then to "Java Build Path" and then add the three projects under the "Projects" tab. Finally, go to the "Java Build Path" properties of the VCT Main project (via "Right-click on project > Build Path > Configure Build Path"), navigate to the "Source" tab, and make sure that there are only two sources listed, which are VCT main/src/main/java and VCT main/target/scala-2.11/src_managed/main/antlr4; remove all other sources.

Now try to rebuild VerCors from the console using ant clean and ant. After performing these steps, Eclipse should not give you any errors on any of the four new projects you just created. If there are any, try to resolve those first before continuing. We will now continue to configure the Viper modules in Eclipse.

Configuring the Viper modules

  1. In Eclipse, create a new Scala project (File > New > Project... > Scala Wizards > Scala Project) with project name "Silver", and instead of using the default location, click "Browse..." and select the ./viper/silver subdirectory of your VerCors build. Eclipse will probably provide some errors at this point. Further configuration of this new project is needed to fix these, which we shall do later.
  2. Create a new Scala project with project name "Silicon" and choose the ./viper/silicon subdirectory of your VerCors build as its location. Further configuration of this new project is needed, which we shall do later.
  3. Create a new Scala project with project name "Carbon" and choose the ./viper/carbon subdirectory of your VerCors build as its location. Further configuration of this new project is done later.
  4. If Eclipse gives you errors saying "Unable to find a Scala library", then the Scala version configured in Eclipse is probably higher than the one used to build VerCors with. Do the following to solve this. Go to the properties of the Silver project, click on "Scala Compiler" in the menu and select version 2.11 in the "Scala installation" field. Then "Apply and Close". Repeat these steps for the Silicon and Carbon projects.
  5. We will now fix the setup for the "Silver" project. Right-click on the Silver project, then navigate to "Build Path > Configure Build Path..". Change the "Source folders on build path" entries so that only Silver/src/main/scala is listed. The "Default output folder" should be set to Silver/target/scala-2.11/classes. Under the "Projects" tab, add the "Viper API" project as dependency. Under the "Libraries" tab, add Silicon/target/scala-2.11/silicon.jar as a dependency. After this, Eclipse should not give any more errors on the Silver project.
  6. We will now fix the setup for the "Silicon" project. Again navigate to the "Java Build Path" window. Change the "Source folders on build path" entries so that only Silicon/src/main/scala is listed. The "Default output folder" should be set to Silicon/target/scala-2.11/classes. Under the "Projects" tab, add the "Viper API" project as dependency. Under the "Libraries" tab, add Silicon/target/scala-2.11/silicon.jar as a dependency. After this, Eclipse should not give any more errors on the Silicon project.
  7. We will now fix the setup for the "Carbon" project. Navigate to the "Java Build Path" window. Change the "Source folders on build path" entries so that only Carbon/src/main/scala is listed. The "Default output folder" should be set to Carbon/target/scala-2.11/classes. Under the "Projects" tab, add the "Viper API" project as dependency. Under the "Libraries" tab, add Carbon/target/scala-2.11/carbon.jar as a dependency. After this, Eclipse should not give any more errors on the Carbon project.

After configuring the VerCors and Viper modules you should have seven new Eclipse projects without any errors. If you experience any problems getting VerCors to work with Eclipse while following these steps, do not hesitate to contact the developers for further help.

Running VerCors from Eclipse

To run VerCors from Eclipse, and thereby allow debugging within Eclipse, a Run Configuration needs to be created and used. To create a run configuration, do the following. In the menu, navigate to "Run > Run Configurations...". Select "Java Application" in the left menu and press the "New" button/icon in the toolbar. From here you can assign a name to the new configuration, for example "VerCors". Under "Project" select the "VCT main" project. Under "Main class" select or type vct.main.Main. Under the "Arguments" tab, type ${string_prompt} in the "Program arguments" field, so that every time VerCors is run with this new configuration, a pop-up window will be given in which arguments to VerCors can be specified. Moreover, in the "VM arguments" field, type -Xss16m, which increases the stack size to 16MB for VerCors runs (the default stack size may not be enough). Finally, move to the "Environment" tab, click on the button "New...", and add a new environment variable with name VCT_HOME and as value the path to the root directory of your VerCors installation.

After performing these steps, you should be able to run VerCors from Eclipse via the "Run" option (do not forget selecting the new run configuration). The output of VerCors is then printed in Eclipse console view.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.