scalus.sir

package scalus.sir

Members list

Packages

Type members

Classlikes

Transforms error messages in SIR to abbreviated forms and collects a mapping of abbreviations to original messages.

Transforms error messages in SIR to abbreviated forms and collects a mapping of abbreviations to original messages.

This transformation helps reduce the size of error messages in the IR while maintaining traceability through a mapping of abbreviated forms to their original messages.

Attributes

Example
   // Input SIR containing: Error("Failed validation"), Error("Failed execution")
   // Transforms to: Error("FV"), Error("FE")
   // With mapping: Map("FV" -> "Failed validation", "FE" -> "Failed execution")
   val transformer = new AbbreviateErrorTraces
   val result = transformer.transformSIR(input)
   val abbrevMap = transformer.getAbbreviationMap
Supertypes
class Object
trait Matchable
class Any
sealed trait AnnotatedSIR extends SIR

Attributes

Supertypes
trait SIR
class Object
trait Matchable
class Any
Known subtypes
class And
class Apply
class Builtin
class Cast
class Const
class Constr
class Error
class ExternalVar
class IfThenElse
class LamAbs
class Let
class Match
class Not
class Or
class Select
class Var
Show all
case class AnnotationsDecl(pos: SIRPosition, comment: Option[String], data: Map[String, SIR])

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case object AnnotationsDecl

Attributes

Companion
class
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
case class Binding(name: String, tp: SIRType, value: SIR)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Provides optimization functionality for boolean expressions in SIR. Applies standard boolean algebra transformations to reduce the number of nodes and simplify expressions.

Provides optimization functionality for boolean expressions in SIR. Applies standard boolean algebra transformations to reduce the number of nodes and simplify expressions.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
case class ConstrDecl(name: String, params: List[TypeBinding], typeParams: List[TypeVar], parentTypeArgs: List[SIRType], annotations: AnnotationsDecl)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class DataDecl(name: String, constructors: List[ConstrDecl], typeParams: List[TypeVar], annotations: AnnotationsDecl)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class Module(version: (Int, Int), name: String, defs: List[Binding])

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object ModuleToExpr extends ToExprHS[Module]

Attributes

Supertypes
class ToExprHS[Module]
trait ToExpr[Module]
class Object
trait Matchable
class Any
Self type
object PrettyPrinter

Pretty printers.

Pretty printers.

  • Use pretty to pretty print to a org.typelevel.paiges.Doc.
  • Use prettyXTerm to pretty print to a org.typelevel.paiges.Doc with syntax highlighting for XTerm.

For example:

PrettyPrinter.prettyXTerm(sir).render(80)
// renders a single line if possible
PrettyPrinter.pretty(sir).flatten.render(120)

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
case class Program(version: (Int, Int, Int), term: SIR)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
sealed trait SIR

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait AnnotatedSIR
class And
class Apply
class Builtin
class Cast
class Const
class Constr
class Error
class ExternalVar
class IfThenElse
class LamAbs
class Let
class Match
class Not
class Or
class Select
class Var
class Decl
Show all
object SIR

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
SIR.type
case class SIRBodyAnnotation(module: Module, deps: List[SIRModuleWithDeps]) extends StaticAnnotation

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
Show all
object SIRBuiltins

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object SIRChecker

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
SIRChecker.type
trait SIRCompiled

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes

Default compiler options for SIR processing. Here to have a single place for default options, which is shared between the compiler plugin and the core library.

Default compiler options for SIR processing. Here to have a single place for default options, which is shared between the compiler plugin and the core library.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
object SIRMacro

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
SIRMacro.type
class SIRModuleWithDeps(val sirModule: Module, sirDepsExpr: => List[SIRCompiled]) extends SIRCompiled

Attributes

Companion
object
Supertypes
trait SIRCompiled
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
case class SIRPosition(file: String, startLine: Int, startColumn: Int, endLine: Int, endColumn: Int)

SIR Position - position in Scala source code.

SIR Position - position in Scala source code.

Value parameters

file

-- fiel of position. Empty file ("") means that position is unknown.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object SIRPosition

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
object SIRToExpr extends ToExprHS[SIR]

Attributes

Supertypes
class ToExprHS[SIR]
trait ToExpr[SIR]
class Object
trait Matchable
class Any
Self type
SIRToExpr.type
sealed trait SIRType

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class CaseClass
class Fun
trait Primitive
object Boolean
object ByteString
object Data
object Integer
object String
object Unit
class SumCaseClass
class TypeLambda
object TypeNothing
class TypeProxy
class TypeVar
Show all
object SIRType

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
SIRType.type
object SIRTypeToExpr extends ToExprHS[SIRType]

Attributes

Supertypes
class ToExprHS[SIRType]
trait ToExpr[SIRType]
class Object
trait Matchable
class Any
Self type
object SIRUnify

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
SIRUnify.type
sealed trait SIRVarStorage

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Cases
object Data
object ScottEncoding
object SIRVarStorage

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
class SimpleSirToUplcLowering(sir: SIR, generateErrorTraces: Boolean)

Lowering from Scalus Intermediate Representation SIR to UPLC Term.

Lowering from Scalus Intermediate Representation SIR to UPLC Term.

Value parameters

generateErrorTraces

whether to generate error traces

sir

the Scalus Intermediate Representation to lower

Attributes

Supertypes
class Object
trait Matchable
class Any
object SirDSL

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
SirDSL.type
class SirToUplc110Lowering(sir: SIR, generateErrorTraces: Boolean)

Lowering from Scalus Intermediate Representation SIR to UPLC Term.

Lowering from Scalus Intermediate Representation SIR to UPLC Term.

We use UPLC version 1.1.0 and generate Sums of Products (SoP) constructors case and constr to represent data types. Also we optimize newtype kind of constructors to be represented as just values.

Value parameters

generateErrorTraces

whether to generate error traces

sir

the Scalus Intermediate Representation to lower

Attributes

Example
case class Wrapper(a: BigInt)
val x = Wrapper(1) // lowers to just (const integer 1)
Supertypes
class Object
trait Matchable
class Any
class SirToUplcV3Lowering(sir: SIR, generateErrorTraces: Boolean, upcastTo: SIRType, representation: LoweredValueRepresentation, debug: Boolean)

Attributes

Supertypes
class Object
trait Matchable
class Any

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
class ToExprHS[T](hst: HashConsedFlat[T], hste: Quotes ?=> Expr[HashConsedFlat[T]], tt: Quotes ?=> Type[T]) extends ToExpr[T]

Attributes

Supertypes
trait ToExpr[T]
class Object
trait Matchable
class Any
Known subtypes
object ModuleToExpr
object SIRToExpr
object SIRTypeToExpr

Called from SIRConverter via reflection.

Called from SIRConverter via reflection.

Attributes

Supertypes
trait Flat[SIR]
class Object
trait Matchable
class Any
Self type

Note, that this hashconsedflat should not be resolved as given. It is used only as parameter to ToExprHS. Given HashConsedFlat[(something other then Module)] is a no-no.

Note, that this hashconsedflat should not be resolved as given. It is used only as parameter to ToExprHS. Given HashConsedFlat[(something other then Module)] is a no-no.

Attributes

Supertypes
trait Flat[SIRType]
class Object
trait Matchable
class Any
Self type
case class TypeBinding(name: String, tp: SIRType)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Concrete fields

val SIRVersion: (Int, Int)

Givens