Compiler

esmeta.compiler.Compiler
See theCompiler companion object
class Compiler(spec: Spec, log: Boolean)

extensible helper of compiler from metalangauge to IR

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Type members

Types

type SimpleOp = PartialFunction[(FuncBuilder, List[Expr]), Expr]

simple operations

simple operations

Attributes

Value members

Concrete methods

def F: EBool
def T: EBool
inline def add(l: Expr, r: Expr): EBinary
def addFunc(fb: FuncBuilder, body: Step, prefix: List[Inst]): Unit

get body instruction

get body instruction

Attributes

inline def and(l: Expr, r: Expr): EBinary
def arityCheck(pair: (String, SimpleOp)): (String, SimpleOp)
def compile(algo: Algorithm): Unit

compile an algorithm to an IR function

compile an algorithm to an IR function

Attributes

def compile(fb: FuncBuilder, step: Step): Unit

compile algorithm steps

compile algorithm steps

Attributes

def compile(x: Variable): Name

compile local variable

compile local variable

Attributes

def compile(fb: FuncBuilder, ref: Reference): Ref

compile references

compile references

Attributes

def compile(fb: FuncBuilder, expr: Expression): Expr

compile expressions

compile expressions

Attributes

compile mathematical operators

compile mathematical operators

Attributes

compile binary operators

compile binary operators

Attributes

compile unary operators

compile unary operators

Attributes

def compile(fb: FuncBuilder, lit: Literal): Expr

compile literals

compile literals

Attributes

compile bitwise operations

compile bitwise operations

Attributes

def compile(fb: FuncBuilder, cond: Condition): Expr

compile branch conditions

compile branch conditions

Attributes

def compile(fb: FuncBuilder, list: Expr, tyOpt: Option[Type], x: Local, givenCond: => Expr): Expr

compile contains condition with additional constraints

compile contains condition with additional constraints

Attributes

def compile(param: Param): Param

compile algorithm parameters

compile algorithm parameters

Attributes

def compile(ty: Type): Type

compile types

compile types

Attributes

def compileShortCircuit(fb: FuncBuilder, x: Ref, cond: Condition, thenStep: Step, elseStep: Option[Step]): Inst

handle short circuiting

handle short circuiting

Attributes

def compileShorthand(fb: FuncBuilder, fname: String, args: List[Expr]): Expr

compile shorthands

compile shorthands

Attributes

compile with a new scope and convert it into an instruction

compile with a new scope and convert it into an instruction

Attributes

inline def dec(e: Expr): EBinary
inline def equal(l: Expr, r: Expr): EBinary
inline def exists(r: Ref): Expr

operation helpers

operation helpers

Attributes

inline def exists(e: Expr): Expr
inline def floor(expr: Expr): EUnary
def getBuiltinPrefix(fb: FuncBuilder, ps: List[Param]): List[Inst]

get prefix instructions for builtin functions

get prefix instructions for builtin functions

Attributes

def getKind(head: Head): FuncKind
def getProductionData(lhsName: String, rhsName: String): Option[(Lhs, Int)]

production helpers

production helpers

Attributes

grammar

grammar

Attributes

inline def hasFields(fb: FuncBuilder, base: Expr, fs: List[String]): Expr
def hasInvokeExpr(cond: Condition): Boolean

check if condition contains invoke expression

check if condition contains invoke expression

Attributes

inline def inc(e: Expr): EBinary
inline def is(l: Expr, r: Expr): EBinary
inline def isIntegral(x: Expr): EBinary
inline def lessThan(l: Expr, r: Expr): EBinary
inline def neg(expr: Expr): EUnary
def not(expr: Expr): Expr
def one: EMath
inline def or(l: Expr, r: Expr): EBinary
def returnIfAbrupt(fb: FuncBuilder, expr: Expr, check: Boolean, imeediateReturn: Boolean): Expr
inline def sub(l: Expr, r: Expr): EBinary
def zero: EMath

literal helpers

literal helpers

Attributes

Concrete fields

val excluded: Set[String]
val exprRules: Map[String, Expr]

load manual compile rules for expressions

load manual compile rules for expressions

Attributes

val fixClosurePrefixAOs: List[Regex]

list of function names which need to replace head to built-in when creating closure (ex: Await)

list of function names which need to replace head to built-in when creating closure (ex: Await)

Attributes

val fixReturnAOs: List[String]

list of function names which need to replace return step return to resumed step since they have no note step for that return

list of function names which need to replace return step return to resumed step since they have no note step for that return

Attributes

val funcs: ListBuffer[Func]

compiled algorithms

compiled algorithms

Attributes

val instRules: Map[String, Inst]

load manual compile rules for instructions

load manual compile rules for instructions

Attributes

val manualFuncMap: Map[String, Func]

load manually created IR functions

load manually created IR functions

Attributes

val manualFuncs: List[Func]

load manually created IR functions

load manually created IR functions

Attributes

load manual compile rules

load manual compile rules

Attributes

val noReturnComp: Set[String]
lazy val result: Program

compiled specification

compiled specification

Attributes

val shorthands: Set[String]
val simpleOps: Map[String, SimpleOp]

load manual compile rules

load manual compile rules

Attributes

var unusedRules: Set[String]

get unused manual compile rules

get unused manual compile rules

Attributes