Using Sireum to create an IVE Project for Slang Scripts

Sireum includes some command line options to generate a skeleton Slang script project that is ready for use within the IVE. This saves having to go through a series of steps within the IVE to set up the project. The command line option will create a project with a single script file. To add other script files to the same project, use the :guilabel:File / New / File menu option in the IVE and manually insert the appropriate Sireum headers and imports (see below).

To generate a “hello world” Slang script project in the current directory and launch Sireum IVE, the following commands can be used (assuming SIREUM_HOME is set to Sireum’s installation path). Instead of the second command in each listing below, the IVE can also be launched using app launcher of the host OS.


  # Generates ./hello project directory with ./hello/src/
  ${SIREUM_HOME}/bin/sireum tools ivegen .
  open ${SIREUM_HOME}/bin/mac/idea/


  # Generates ./hello project directory with ./hello/src/
  ${SIREUM_HOME}/bin/sireum tools ivegen .


  REM Generates .\hello project directory with .\hello\src\
  %SIREUM_HOME%\bin\sireum.bat tools ivegen . 
  cmd /C %SIREUM_HOME%\bin\win\idea\bin\IVE.exe

Once Sireum IVE is running, open the hello directory as a project using the :guilabel:File / Open menu option, then open the file for editing. (When asked to add Ammonite dependencies, choose Ignore for now; you can add the dependencies but it might take a while to download the packages.)


Opening and Executing the Sireum-generated Hello Slang script project

To run the script, click on the green ► button at the top-left part of the editor (or click on the green ► button on the right side of “Run” at the top-right part of the window). Execution opens the Run pane at the bottom of the IVE to show console output for the script.


Note: The green arrow on the left calls the tool pipeline directly from in Java whereas the “Slang Script Runner” calls a shell script which launches a separate JVM.

To rename the IntelliJ/IVE module to something other than “Hello”, select the project name in the resource browser and use context menu to rename. To rename the project itself, close the project and rename the folder containing the project from the file system.


Renaming the Slang script module

Alternatively, when originally creating the project, the ivegen tool can be passed a command line argument using the switches -n or --name to specify the name as illustrated below for macOS (Linux and Windows are similar).


  # Generates ./myfavproj project directory with ./myfavproj/src/
  ${SIREUM_HOME}/bin/sireum tools ivegen --name myfavproj .

To generate the project in a location other than the current directory, replace the . with the target directory, e.g.,

  # Generates <mytargetdirectory>/myfavproj project directory with <mytargetdirectory>/myfavproj/src/
  ${SIREUM_HOME}/bin/sireum tools ivegen --name myfavproj <mytargetdirectory>


${SIREUM_HOME}/bin/sireum tools ivegen -n slang-by-examples-git –module slang-by-examples . I gave the above command in the directory above slang-by-examples-git folder to populate an existing collection of scripts in slang-by-examples-git/src with the name slang-by-examples used as the module name

Creating Additional Scripts in the Project


Creating additional scripts within the proejct

Additional scripts within the same project can be created using the IVE :guilabel:File / New / File to create a file with a .sc extension (e.g. as illustrated in the figure above. This script illustrates how the Slang example fragments from other chapters to can be put into scripts for experimenting with language features. Note that each script file must start with the Sireum file indicator and import.

  // #Sireum
  import org.sireum._

The // #Sireum tells the IVE that the file should be recognized as a Slang file for editor support and for compilation / execution.