Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
research:software:effscript [2015/06/04 10:45] mtororesearch:software:effscript [2015/08/19 11:02] (current) mtoro
Line 1: Line 1:
 ====== EffScript: Practical Effects for Scala ====== ====== EffScript: Practical Effects for Scala ======
 +
 +{{bib>toroTanter-oopsla2015|Customizable Gradual Polymorphic Effects for Scala}} accepted at [[http://2015.splashcon.org/track/oopsla2015|OOPSLA 2015]] [[http://2015.splashcon.org/track/splash2015-artifacts|{{research:aec-oopsla.png?100}}]]
  
 EffScript is a small domain-specific language for writing tailored effect disciplines for Scala. In addition to being customizable, the underlying effect system supports both effect polymorphism (as developed by Lukas Rytz in his PhD thesis) and gradual effect checking (following the theory of Bañados, Garcia and Tanter). EffScript is a small domain-specific language for writing tailored effect disciplines for Scala. In addition to being customizable, the underlying effect system supports both effect polymorphism (as developed by Lukas Rytz in his PhD thesis) and gradual effect checking (following the theory of Bañados, Garcia and Tanter).
Line 8: Line 10:
 The implementation of the Practical Effect system is developed as a compiler plugin for the Scala programming language. The plugin is based on the plugin developed by Rytz //et al// and is composed of two sub plugins to implement bidirectional checking: the effect inference plugin, and the effect checking plugin. The  effect inference plugin is a modification of the one developed by Rytz //et al//, extended with support for gradual effects and the customizable effect system. In relation to bidirectional checking, Scala has inference of effect, therefore there are cases where there is absence of effect annotations. The effect inference plugin is necessary to annotate function abstractions that do not have effect annotations. This information about effect inference is used by the effect checking plugin to  check and adjust  sets of effect privileges, also inserting runtime checks of effect wherever it may be necessary. The implementation of the Practical Effect system is developed as a compiler plugin for the Scala programming language. The plugin is based on the plugin developed by Rytz //et al// and is composed of two sub plugins to implement bidirectional checking: the effect inference plugin, and the effect checking plugin. The  effect inference plugin is a modification of the one developed by Rytz //et al//, extended with support for gradual effects and the customizable effect system. In relation to bidirectional checking, Scala has inference of effect, therefore there are cases where there is absence of effect annotations. The effect inference plugin is necessary to annotate function abstractions that do not have effect annotations. This information about effect inference is used by the effect checking plugin to  check and adjust  sets of effect privileges, also inserting runtime checks of effect wherever it may be necessary.
  
 +===== Getting Started Guide =====
 ==== The implementation ==== ==== The implementation ====
  
-The code and examples can be downloaded [[http://pleiad.cl/_media/research/software/effscript_implementation.tar.gz|here]].+ 
 +The code and examples can be downloaded {{:research:software:effscript:paper_225.tar.gz|here}}. 
 + 
 +Alternatively, a virtual box image can be downloaded [[http://www.pleiad.cl/paper_225_image.tar.gz|here]]. 
 +Access with username: ubuntu and password: ubuntu, all the code and examples can be found inside folder ''effscript_implementation''
 To run the examples, you need to have installed Scala (http://www.scala-lang.org/), SBT (http://www.scala-sbt.org/) and JDK1.7 (http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html). To run the examples, you need to have installed Scala (http://www.scala-lang.org/), SBT (http://www.scala-sbt.org/) and JDK1.7 (http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html).
  
Line 50: Line 58:
     bottom: @simpleNoIO     bottom: @simpleNoIO
  
-pointcuts:+effspecs:
         def views.html.dummy.apply() prod @simpleNoIO         def views.html.dummy.apply() prod @simpleNoIO
         def views.html.foo.apply[T]() prod @simpleNoIO         def views.html.foo.apply[T]() prod @simpleNoIO
Line 71: Line 79:
 chmod +x copyCompilerLibs.sh #make sure the file has execution permissions chmod +x copyCompilerLibs.sh #make sure the file has execution permissions
 ./copyCompilerLibs.sh playground ./copyCompilerLibs.sh playground
-</code> \\ The ''copyCompilerLibs.sh'' script create two symbolic links to a folder lib at the root of the provided path. +</code> \\ The ''copyCompilerLibs.sh'' script creates two symbolic links to a folder lib at the root of the provided path. 
   - Creating the symbolic links manually \\ Alternatively we can create the symbolic links manually. The ''copyCompilerLibs.sh'' script is equivalent to (note that the path to the jar must be **absolute path**, using a relative path will not work properly): <code>   - Creating the symbolic links manually \\ Alternatively we can create the symbolic links manually. The ''copyCompilerLibs.sh'' script is equivalent to (note that the path to the jar must be **absolute path**, using a relative path will not work properly): <code>
 cd playground cd playground
Line 177: Line 185:
 </code> </code>
  
 +====== Step by Step Instructions ======
 ===== Architectural Constraints in Play ===== ===== Architectural Constraints in Play =====
-The effscript file to enforce the MVC pattern in Play with Effscript is defined in ''eff-examples/DBAccess.eff''.+The effscript File ''eff-examples/DBAccess.eff'' enforces the MVC pattern in a Play framework application.
 To modify the discipline, just edit the ''DBAccess.eff'' file, and then run To modify the discipline, just edit the ''DBAccess.eff'' file, and then run
  
Line 363: Line 371:
 sbt "run 2" sbt "run 2"
 </code> </code>
 +
 +===== Plotting the results =====
 +To plot the benchmark results we have provided a zip file with the required files [[http://pleiad.cl/_media/research/software/effscript/plot.zip|plot.zip]].
 +
 +
 +You will need the following python libraries (I recommend install them using "easy_install" command of setuptools https://pypi.python.org/pypi/setuptools):
 +- numpy
 +- matplotlib
 +
 +Place the content of the zip file inside the benchmark folder. Then, edit ''runbenchmark'' file to set the number of iteration by editing variable ''n'':
 +
 +<code bash>
 +#!/bin/bash
 +n=1
 +...
 +</code>
 +
 +<HTML>
 +<p style="border:1px solid red;padding:5px;">
 +Before running the benchmarks we recommend re packaging the CollsSimple project. The reason for this is that at the moment of the artifact submission, CollsSimple was compiled and packaged using the bit vector version of the compiler plugins. Later we updated the effect compiler plugins but we did not repackage the project.</p>
 +</HTML>
 +<code bash>
 +cd CollsSimple
 +sbt package
 +</code>
 +
 +To run the benchmarks, at the root of the benchmarks folder run:
 +<code bash>
 +./runbenchmark > outputbenchmark
 +</code>
 +
 +The execution will output the results in ''outputbenchmark'' file. We have provided a ''outputbenchmark'' example file.
 +
 +To plot the results just run:
 +<code bash>
 +python buildGraph.py
 +</code>
 +It will generate a ''benchmark.pdf'' file with the plot. We have provided a ''benchmark.pdf'' example file.
 +