Skip to content

StackSLSemantics.kt

src/jvmMain/kotlin/afield/lang/stacksl/StackSLSemantics.kt · 25 lines

package afield.lang.stacksl

sealed interface StackSLSemanticType

Compile-time meanings of StackSL's vec4 values.

data object RawVec4 : StackSLSemanticType

data object RealInvariant : StackSLSemanticType

data class ComplexSpin(val weight: Int) : StackSLSemanticType

The xy lanes transform by multiplication by exp(i * weight * angle).

override fun toString(): String = "ComplexSpin($weight)"

data class StackSLInputAssumption(val source: String, val type: StackSLSemanticType)

A contract on the host-supplied coordinate read by source.

data class StackSLSemanticAnalysis

SO(2) analysis of the root result, conditional on the listed input contracts.

data class StackSLSemanticAnalysis(
    val outputType: StackSLSemanticType,
    val assumptions: List<StackSLInputAssumption>,
    val uncertifiedReasons: List<String>
) {

val equivarianceCertified: Boolean get() = uncertifiedReasons.isEmpty()