abstract class FileCodegen[+ScalanCake <: ScalanEx] extends AnyRef
Base class for code generators
- Alphabetic
- By Inheritance
- FileCodegen
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new FileCodegen(scalan: ScalanCake, config: CodegenConfig)
Type Members
- sealed trait BaseNumericType extends AnyRef
- sealed trait SpecialNumericValue extends AnyRef
- trait SrcStringHelper extends AnyRef
- class SrcStringHelperBase extends SrcStringHelper
Abstract Value Members
-
abstract
def
emitFooter(graph: ScalanCake.PGraph, functionName: String)(implicit stream: PrintWriter): Unit
Emits the final part of the file (after the kernel)
-
abstract
def
emitHeader(graph: ScalanCake.PGraph, functionName: String)(implicit stream: PrintWriter): Unit
Emits the initial part of the file (before the kernel)
- abstract def functionFooter(): Option[String]
- abstract def functionHeader(sym: ScalanCake.Sym, args: List[ScalanCake.Sym]): String
- abstract def functionReturn(y: ScalanCake.Sym): String
-
abstract
def
languageName: String
Name of language generated (used in error messages)
-
abstract
def
simpleNode(sym: ScalanCake.Sym, d: ScalanCake.Def[_]): String
Translation of a simple (non-complex) node.
Translation of a simple (non-complex) node. Normally calls
tpe(sym.elem)
(in typed languages),id(sym)
andrhs(d)
. Example for C:src"${sym.elem} $sym = $d;
.- Attributes
- protected
- abstract def specialNumericLiteral(x: SpecialNumericValue, t: BaseNumericType): String
- implicit abstract def srcStringHelper(sc: StringContext): SrcStringHelper
Concrete 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
- def applyFunction(f: ScalanCake.Sym, args: Seq[ScalanCake.Sym]): String
-
def
argList(f: ScalanCake.Sym, x: ScalanCake.Sym): List[ScalanCake.Sym]
Assume x is right-nested tuple like (a_1, (a_2, (a_3, ...
Assume x is right-nested tuple like (a_1, (a_2, (a_3, ... (a_{N-1}, a_N)...)
- returns
a list of a_i
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- def binOp(op: ScalanCake.BinOp[_, _], x: ScalanCake.Sym, y: ScalanCake.Sym): String
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
lazy val
codegenName: String
Codegen name (used in error messages)
- val config: CodegenConfig
- def emit(string: String)(implicit stream: PrintWriter, indentLevel: IndentLevel): Unit
- def emit(lines: Seq[String])(implicit stream: PrintWriter, indentLevel: IndentLevel): Unit
- def emitFunction(sym: ScalanCake.Sym, args: List[ScalanCake.Sym], returnValue: Option[ScalanCake.Ref[Any]], lambdaOrThunk: ScalanCake.AstGraph, f: (ScalanCake.Schedule) ⇒ ScalanCake.Schedule = identity)(implicit stream: PrintWriter, indentLevel: IndentLevel): Unit
-
def
emitKernel(graph: ScalanCake.PGraph, functionName: String)(implicit stream: PrintWriter): Unit
Emits the kernel
-
def
emitNode(sym: ScalanCake.Sym, d: ScalanCake.Def[_], graph: ScalanCake.AstGraph)(implicit stream: PrintWriter, indentLevel: IndentLevel): Unit
Emits a node in the schedule.
Emits a node in the schedule. Override this for nodes which need more than one line, and
rhs
for the simple cases. - def emitSchedule(graph: ScalanCake.AstGraph, f: (ScalanCake.Schedule) ⇒ ScalanCake.Schedule = identity)(implicit stream: PrintWriter, indentLevel: IndentLevel): Unit
-
def
emitSourceFile(graph: ScalanCake.PGraph, functionName: String, sourcesDir: File): File
Emits the complete source file
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
fileExtension: String
File extension for generated code
-
def
fileName(baseName: String): String
File name (with extension) for generated code
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
id(s: ScalanCake.Sym): String
Translation of a
Sym
to variable name - val importBuilder: ImportBuilder
-
def
indent: String
Standard indentation for one level is 4 spaces, can be according to defaults of the specific language
Standard indentation for one level is 4 spaces, can be according to defaults of the specific language
- Attributes
- protected
-
def
indented(f: (IndentLevel) ⇒ Unit)(implicit indentLevel: IndentLevel): Unit
Executes given function
f
with incremented identation.Executes given function
f
with incremented identation. Current identation at call site is passed as implicit parameter. -
def
init(functionName: String, graph: ScalanCake.PGraph): Unit
Prepares to work with a kernel
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
literal(value: Any): String
Translation of a literal.
Translation of a literal. The default is C/Java literals for primitives and
null
. -
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
reset(): Unit
Finishes working with a kernel
-
def
rhs(d: ScalanCake.Def[_]): String
Translation of a
Def
- val scalan: ScalanCake
- def sourceFile(sourcesDir: File, functionName: String): File
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- FileCodegen → AnyRef → Any
-
def
tpe(elem: ScalanCake.Elem[_]): String
Translation of the type represented by an
Elem
to the generated language (no need to implement for weakly typed or fully type-inferred languages). -
def
translateToSrc(arg: Any): String
- Attributes
- protected
- def unOp(op: ScalanCake.UnOp[_, _], x: ScalanCake.Sym): String
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
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( ... )
- object DOUBLE extends BaseNumericType with Product with Serializable
- object FLOAT extends BaseNumericType with Product with Serializable
- object NaN extends SpecialNumericValue with Product with Serializable
- object NegInf extends SpecialNumericValue with Product with Serializable
- object PosInf extends SpecialNumericValue with Product with Serializable