object Main
Fork of Scala-AM (written by Quentin Stiévenart) https://github.com/acieroid/scala-am with the final goal to parallelize it: https://bitbucket.org/OPiMedia/scala-par-am
Before looking at this, we recommend seeing how to use this framework. A detailed example is available in examples/LambdaCalculus.scala.
This is the entry point. It parses the arguments, parses the input file and launches an abstract machine on the parsed expression (or launches a REPL if no input file is given). The pipeline goes as follows:
- The input program is parsed. For Scheme programs, it is done by:
- Parsing the file as a list of s-expressions (exp/SExp.scala, exp/SExpParser.scala)
- Compiling these s-expressions into Scheme expressions (exp/scheme/Scheme.scala)
2. To run the program, we need an abstract machine and some semantics. Semantics definitions have to implement the Semantics interface (semantics/Semantics.scala).
3. Once the abstract machine is created and we have a semantics for the program we want to analyze, the abstract machine can perform its evaluation, relying on methods of the semantics class to know how to evaluate expressions. The abstract machine only deals with which states to evaluate in which order, where to store values, where to store continuations, how to push and pop continuations, etc. The semantics encode what to do when encountering a program construct. For example, the semantics can tell what to evaluate next, that a continuation needs to be pushed, or that a variable needs to be updated. The abstract machine will then respectively evaluate the expression needed, push the continuation, or update the variable.
Multiple abstract machine implementations are available, defined in the machine/ directory. Every abstract machine implementation has to implement the AbstractMachine interface (machine/AbstractMachine.scala).
The abstract machine also uses a lattice to represent values. Lattices should implement the JoinLattice trait that can be found in lattice/JoinLattice.scala, which provides the basic features of a lattice.
If you want to:
- Support a new language: you will need:
- A parser, you can look into exp/SExpParser.scala as an inspiration. If your language is s-expression based, you can use this parser and compile s-expressions into your abstract grammar. To do so, look at exp/scheme/Scheme.scala.
- An abstract grammar, look at exp/SExp.scala or the SchemeExp class in exp/scheme/Scheme.scala.
- A semantics, look at semantics/anf/ANFSemantics.scala for a simple example.
- Support for your language operations at the lattice level. For this, you'll probably need to extend the lattices (see lattice/scheme/SchemeLattice.scala, lattice/scheme/ModularLattice.scala)
- Play with abstract machines, you can look into AAM.scala.
- Implement some kind of analysis, look at examples/LambdaCalculus.scala and examples/TaintAnalysis.scala.
- Alphabetic
- By Inheritance
- Main
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def main(args: Array[String]): Unit
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
run[Exp, Abs, Addr, Time](machine: AbstractMachine[Exp, Abs, Addr, Time], sem: Semantics[Exp, Abs, Addr, Time])(program: String, outputDot: Option[String], outputJSON: Option[String], timeout: Option[Long], inspect: Boolean)(implicit arg0: Expression[Exp], arg1: JoinLattice[Abs], arg2: Address[Addr], arg3: Timestamp[Time]): (Int, Double)
Run a machine on a program with the given semantics.
Run a machine on a program with the given semantics. If @param output is set, generate a dot graph visualizing the computed graph in the given file. Return the number of states and time taken.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )