arguments) {
- return (Double) ((Function2) this.constants[0]).invoke((Double) MapIntrinsics.getOrFail(arguments, "x"), 2);
- }
-
- public AsmCompiledExpression_45045_0(Object[] constants) {
- this.constants = constants;
- }
-}
-
-```
-
-#### Known issues
-
-- The same classes may be generated and loaded twice, so it is recommended to cache compiled expressions to avoid class
- loading overhead.
-- This API is not supported by non-dynamic JVM implementations (like TeaVM and GraalVM) because of using class loaders.
-
-### On JS
-
-A similar feature is also available on JS.
-
-```kotlin
-import space.kscience.kmath.expressions.Symbol.Companion.x
-import space.kscience.kmath.expressions.*
-import space.kscience.kmath.operations.*
-import space.kscience.kmath.estree.*
-
-MstField { x + 2 }.compileToExpression(DoubleField)
-```
-
-The code above returns expression implemented with such a JS function:
-
-```js
-var executable = function (constants, arguments) {
- return constants[1](constants[0](arguments, "x"), 2);
-};
-```
-
-JS also supports experimental expression optimization with [WebAssembly](https://webassembly.org/) IR generation.
-Currently, only expressions inside `DoubleField` and `IntRing` are supported.
-
-```kotlin
-import space.kscience.kmath.expressions.Symbol.Companion.x
-import space.kscience.kmath.expressions.*
-import space.kscience.kmath.operations.*
-import space.kscience.kmath.wasm.*
-
-MstField { x + 2 }.compileToExpression(DoubleField)
-```
-
-An example of emitted Wasm IR in the form of WAT:
-
-```lisp
-(func $executable (param $0 f64) (result f64)
- (f64.add
- (local.get $0)
- (f64.const 2)
- )
-)
-```
-
-#### Known issues
-
-- ESTree expression compilation uses `eval` which can be unavailable in several environments.
-- WebAssembly isn't supported by old versions of browsers (see https://webassembly.org/roadmap/).
-
-## Rendering expressions
-
-kmath-ast also includes an extensible engine to display expressions in LaTeX or MathML syntax.
-
-Example usage:
-
-```kotlin
-import space.kscience.kmath.ast.*
-import space.kscience.kmath.ast.rendering.*
-import space.kscience.kmath.misc.*
-
-@OptIn(UnstableKMathAPI::class)
-public fun main() {
- val mst = "exp(sqrt(x))-asin(2*x)/(2e10+x^3)/(12)+x^(2/3)".parseMath()
- val syntax = FeaturedMathRendererWithPostProcess.Default.render(mst)
- val latex = LatexSyntaxRenderer.renderWithStringBuilder(syntax)
- println("LaTeX:")
- println(latex)
- println()
- val mathML = MathMLSyntaxRenderer.renderWithStringBuilder(syntax)
- println("MathML:")
- println(mathML)
-}
-```
-
-Result LaTeX:
-
-
-
-![](https://latex.codecogs.com/gif.latex?%5Coperatorname{exp}%5C,%5Cleft(%5Csqrt{x}%5Cright)-%5Cfrac{%5Cfrac{%5Coperatorname{arcsin}%5C,%5Cleft(2%5C,x%5Cright)}{2%5Ctimes10^{10}%2Bx^{3}}}{12}+x^{2/3})
-
-
-Result MathML (can be used with MathJax or other renderers):
-
-
-
-```html
-
-```
-
-
-
-It is also possible to create custom algorithms of render, and even add support of other markup languages
-(see API reference).
diff --git a/kmath-ast/build.gradle.kts b/kmath-ast/build.gradle.kts
deleted file mode 100644
index 9de7e9980..000000000
--- a/kmath-ast/build.gradle.kts
+++ /dev/null
@@ -1,81 +0,0 @@
-plugins {
- kotlin("multiplatform")
- id("ru.mipt.npm.gradle.common")
-}
-
-kotlin.js {
- nodejs {
- testTask {
- useMocha().timeout = "0"
- }
- }
-
- browser {
- testTask {
- useMocha().timeout = "0"
- }
- }
-}
-
-kotlin.sourceSets {
- filter { it.name.contains("test", true) }
- .map(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet::languageSettings)
- .forEach { it.useExperimentalAnnotation("space.kscience.kmath.misc.UnstableKMathAPI") }
-
- commonMain {
- dependencies {
- api("com.github.h0tk3y.betterParse:better-parse:0.4.2")
- api(project(":kmath-core"))
- }
- }
-
- commonTest {
- dependencies {
- implementation(project(":kmath-complex"))
- }
- }
-
- jsMain {
- dependencies {
- implementation(npm("astring", "1.7.5"))
- implementation(npm("binaryen", "101.0.0"))
- implementation(npm("js-base64", "3.6.1"))
- }
- }
-
- jvmMain {
- dependencies {
- implementation("org.ow2.asm:asm-commons:9.2")
- }
- }
-}
-
-//Workaround for https://github.com/Kotlin/dokka/issues/1455
-tasks.dokkaHtml {
- dependsOn(tasks.build)
-}
-
-readme {
- maturity = ru.mipt.npm.gradle.Maturity.EXPERIMENTAL
- propertyByTemplate("artifact", rootProject.file("docs/templates/ARTIFACT-TEMPLATE.md"))
-
- feature(
- id = "expression-language",
- ref = "src/commonMain/kotlin/space/kscience/kmath/ast/parser.kt"
- ) { "Expression language and its parser" }
-
- feature(
- id = "mst-jvm-codegen",
- ref = "src/jvmMain/kotlin/space/kscience/kmath/asm/asm.kt"
- ) { "Dynamic MST to JVM bytecode compiler" }
-
- feature(
- id = "mst-js-codegen",
- ref = "src/jsMain/kotlin/space/kscience/kmath/estree/estree.kt"
- ) { "Dynamic MST to JS compiler" }
-
- feature(
- id = "rendering",
- ref = "src/commonMain/kotlin/space/kscience/kmath/ast/rendering/MathRenderer.kt"
- ) { "Extendable MST rendering" }
-}
diff --git a/kmath-ast/docs/README-TEMPLATE.md b/kmath-ast/docs/README-TEMPLATE.md
deleted file mode 100644
index 9494af63a..000000000
--- a/kmath-ast/docs/README-TEMPLATE.md
+++ /dev/null
@@ -1,212 +0,0 @@
-# Module kmath-ast
-
-Performance and visualization extensions to MST API.
-
-${features}
-
-${artifact}
-
-## Dynamic expression code generation
-
-### On JVM
-
-`kmath-ast` JVM module supports runtime code generation to eliminate overhead of tree traversal. Code generator builds a
-special implementation of `Expression` with implemented `invoke` function.
-
-For example, the following builder:
-
-```kotlin
-import space.kscience.kmath.expressions.Symbol.Companion.x
-import space.kscience.kmath.expressions.*
-import space.kscience.kmath.operations.*
-import space.kscience.kmath.asm.*
-
-MstField { x + 2 }.compileToExpression(DoubleField)
-```
-
-... leads to generation of bytecode, which can be decompiled to the following Java class:
-
-```java
-package space.kscience.kmath.asm.generated;
-
-import java.util.Map;
-
-import kotlin.jvm.functions.Function2;
-import space.kscience.kmath.asm.internal.MapIntrinsics;
-import space.kscience.kmath.expressions.Expression;
-import space.kscience.kmath.expressions.Symbol;
-
-public final class AsmCompiledExpression_45045_0 implements Expression {
- private final Object[] constants;
-
- public final Double invoke(Map arguments) {
- return (Double) ((Function2) this.constants[0]).invoke((Double) MapIntrinsics.getOrFail(arguments, "x"), 2);
- }
-
- public AsmCompiledExpression_45045_0(Object[] constants) {
- this.constants = constants;
- }
-}
-
-```
-
-#### Known issues
-
-- The same classes may be generated and loaded twice, so it is recommended to cache compiled expressions to avoid class
- loading overhead.
-- This API is not supported by non-dynamic JVM implementations (like TeaVM and GraalVM) because of using class loaders.
-
-### On JS
-
-A similar feature is also available on JS.
-
-```kotlin
-import space.kscience.kmath.expressions.Symbol.Companion.x
-import space.kscience.kmath.expressions.*
-import space.kscience.kmath.operations.*
-import space.kscience.kmath.estree.*
-
-MstField { x + 2 }.compileToExpression(DoubleField)
-```
-
-The code above returns expression implemented with such a JS function:
-
-```js
-var executable = function (constants, arguments) {
- return constants[1](constants[0](arguments, "x"), 2);
-};
-```
-
-JS also supports experimental expression optimization with [WebAssembly](https://webassembly.org/) IR generation.
-Currently, only expressions inside `DoubleField` and `IntRing` are supported.
-
-```kotlin
-import space.kscience.kmath.expressions.Symbol.Companion.x
-import space.kscience.kmath.expressions.*
-import space.kscience.kmath.operations.*
-import space.kscience.kmath.wasm.*
-
-MstField { x + 2 }.compileToExpression(DoubleField)
-```
-
-An example of emitted Wasm IR in the form of WAT:
-
-```lisp
-(func \$executable (param \$0 f64) (result f64)
- (f64.add
- (local.get \$0)
- (f64.const 2)
- )
-)
-```
-
-#### Known issues
-
-- ESTree expression compilation uses `eval` which can be unavailable in several environments.
-- WebAssembly isn't supported by old versions of browsers (see https://webassembly.org/roadmap/).
-
-## Rendering expressions
-
-kmath-ast also includes an extensible engine to display expressions in LaTeX or MathML syntax.
-
-Example usage:
-
-```kotlin
-import space.kscience.kmath.ast.*
-import space.kscience.kmath.ast.rendering.*
-import space.kscience.kmath.misc.*
-
-@OptIn(UnstableKMathAPI::class)
-public fun main() {
- val mst = "exp(sqrt(x))-asin(2*x)/(2e10+x^3)/(12)+x^(2/3)".parseMath()
- val syntax = FeaturedMathRendererWithPostProcess.Default.render(mst)
- val latex = LatexSyntaxRenderer.renderWithStringBuilder(syntax)
- println("LaTeX:")
- println(latex)
- println()
- val mathML = MathMLSyntaxRenderer.renderWithStringBuilder(syntax)
- println("MathML:")
- println(mathML)
-}
-```
-
-Result LaTeX:
-
-
-
-![](https://latex.codecogs.com/gif.latex?%5Coperatorname{exp}%5C,%5Cleft(%5Csqrt{x}%5Cright)-%5Cfrac{%5Cfrac{%5Coperatorname{arcsin}%5C,%5Cleft(2%5C,x%5Cright)}{2%5Ctimes10^{10}%2Bx^{3}}}{12}+x^{2/3})
-
-
-Result MathML (can be used with MathJax or other renderers):
-
-
-
-```html
-
-```
-
-
-
-It is also possible to create custom algorithms of render, and even add support of other markup languages
-(see API reference).
diff --git a/kmath-ast/reference/ArithmeticsEvaluator.g4 b/kmath-ast/reference/ArithmeticsEvaluator.g4
deleted file mode 100644
index dc47b23fb..000000000
--- a/kmath-ast/reference/ArithmeticsEvaluator.g4
+++ /dev/null
@@ -1,59 +0,0 @@
-grammar ArithmeticsEvaluator;
-
-fragment DIGIT: '0'..'9';
-fragment LETTER: 'a'..'z';
-fragment CAPITAL_LETTER: 'A'..'Z';
-fragment UNDERSCORE: '_';
-
-ID: (LETTER | UNDERSCORE | CAPITAL_LETTER) (LETTER | UNDERSCORE | DIGIT | CAPITAL_LETTER)*;
-NUM: (DIGIT | '.')+ ([eE] [-+]? DIGIT+)?;
-MUL: '*';
-DIV: '/';
-PLUS: '+';
-MINUS: '-';
-POW: '^';
-COMMA: ',';
-LPAR: '(';
-RPAR: ')';
-WS: [ \n\t\r]+ -> skip;
-
-num
- : NUM
- ;
-
-singular
- : ID
- ;
-
-unaryFunction
- : ID LPAR subSumChain RPAR
- ;
-
-binaryFunction
- : ID LPAR subSumChain COMMA subSumChain RPAR
- ;
-
-term
- : num
- | singular
- | unaryFunction
- | binaryFunction
- | MINUS term
- | LPAR subSumChain RPAR
- ;
-
-powChain
- : term (POW term)*
- ;
-
-divMulChain
- : powChain ((DIV | MUL) powChain)*
- ;
-
-subSumChain
- : divMulChain ((PLUS | MINUS) divMulChain)*
- ;
-
-rootParser
- : subSumChain EOF
- ;
diff --git a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/parser.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/parser.kt
deleted file mode 100644
index b02cc926b..000000000
--- a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/parser.kt
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast
-
-import com.github.h0tk3y.betterParse.combinators.*
-import com.github.h0tk3y.betterParse.grammar.Grammar
-import com.github.h0tk3y.betterParse.grammar.parseToEnd
-import com.github.h0tk3y.betterParse.grammar.parser
-import com.github.h0tk3y.betterParse.grammar.tryParseToEnd
-import com.github.h0tk3y.betterParse.lexer.Token
-import com.github.h0tk3y.betterParse.lexer.TokenMatch
-import com.github.h0tk3y.betterParse.lexer.literalToken
-import com.github.h0tk3y.betterParse.lexer.regexToken
-import com.github.h0tk3y.betterParse.parser.ParseResult
-import com.github.h0tk3y.betterParse.parser.Parser
-import space.kscience.kmath.expressions.MST
-import space.kscience.kmath.expressions.StringSymbol
-import space.kscience.kmath.operations.FieldOperations
-import space.kscience.kmath.operations.GroupOperations
-import space.kscience.kmath.operations.PowerOperations
-import space.kscience.kmath.operations.RingOperations
-
-/**
- * better-parse implementation of grammar defined in the ArithmeticsEvaluator.g4.
- *
- * @author Alexander Nozik
- * @author Iaroslav Postovalov
- */
-public object ArithmeticsEvaluator : Grammar() {
- private val num: Token by regexToken("[\\d.]+(?:[eE][-+]?\\d+)?".toRegex())
- private val id: Token by regexToken("[a-z_A-Z][\\da-z_A-Z]*".toRegex())
- private val lpar: Token by literalToken("(")
- private val rpar: Token by literalToken(")")
- private val comma: Token by literalToken(",")
- private val mul: Token by literalToken("*")
- private val pow: Token by literalToken("^")
- private val div: Token by literalToken("/")
- private val minus: Token by literalToken("-")
- private val plus: Token by literalToken("+")
- private val ws: Token by regexToken("\\s+".toRegex(), ignore = true)
-
- private val number: Parser by num use { MST.Numeric(text.toDouble()) }
- private val singular: Parser by id use { StringSymbol(text) }
-
- private val unaryFunction: Parser by (id and -lpar and parser(ArithmeticsEvaluator::subSumChain) and -rpar)
- .map { (id, term) -> MST.Unary(id.text, term) }
-
- private val binaryFunction: Parser by id
- .and(-lpar)
- .and(parser(ArithmeticsEvaluator::subSumChain))
- .and(-comma)
- .and(parser(ArithmeticsEvaluator::subSumChain))
- .and(-rpar)
- .map { (id, left, right) -> MST.Binary(id.text, left, right) }
-
- private val term: Parser by number
- .or(binaryFunction)
- .or(unaryFunction)
- .or(singular)
- .or(-minus and parser(ArithmeticsEvaluator::term) map { MST.Unary(GroupOperations.MINUS_OPERATION, it) })
- .or(-lpar and parser(ArithmeticsEvaluator::subSumChain) and -rpar)
-
- private val powChain: Parser by leftAssociative(term = term, operator = pow) { a, _, b ->
- MST.Binary(PowerOperations.POW_OPERATION, a, b)
- }
-
- private val divMulChain: Parser by leftAssociative(
- term = powChain,
- operator = div or mul use TokenMatch::type
- ) { a, op, b ->
- if (op == div)
- MST.Binary(FieldOperations.DIV_OPERATION, a, b)
- else
- MST.Binary(RingOperations.TIMES_OPERATION, a, b)
- }
-
- private val subSumChain: Parser by leftAssociative(
- term = divMulChain,
- operator = plus or minus use TokenMatch::type
- ) { a, op, b ->
- if (op == plus)
- MST.Binary(GroupOperations.PLUS_OPERATION, a, b)
- else
- MST.Binary(GroupOperations.MINUS_OPERATION, a, b)
- }
-
- override val rootParser: Parser by subSumChain
-}
-
-/**
- * Tries to parse the string into [MST] using [ArithmeticsEvaluator]. Returns [ParseResult] representing expression or error.
- *
- * @receiver the string to parse.
- * @return the [MST] node.
- */
-public fun String.tryParseMath(): ParseResult = ArithmeticsEvaluator.tryParseToEnd(this)
-
-/**
- * Parses the string into [MST] using [ArithmeticsEvaluator].
- *
- * @receiver the string to parse.
- * @return the [MST] node.
- */
-public fun String.parseMath(): MST = ArithmeticsEvaluator.parseToEnd(this)
diff --git a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/LatexSyntaxRenderer.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/LatexSyntaxRenderer.kt
deleted file mode 100644
index bf5916fa5..000000000
--- a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/LatexSyntaxRenderer.kt
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast.rendering
-
-import space.kscience.kmath.misc.UnstableKMathAPI
-
-/**
- * [SyntaxRenderer] implementation for LaTeX.
- *
- * The generated string is a valid LaTeX fragment to be used in the Math Mode.
- *
- * Example usage:
- *
- * ```
- * \documentclass{article}
- * \begin{document}
- * \begin{equation}
- * %code generated by the syntax renderer
- * \end{equation}
- * \end{document}
- * ```
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public object LatexSyntaxRenderer : SyntaxRenderer {
- override fun render(node: MathSyntax, output: Appendable): Unit = output.run {
- fun render(syntax: MathSyntax) = render(syntax, output)
-
- when (node) {
- is NumberSyntax -> append(node.string)
- is SymbolSyntax -> append(node.string)
-
- is OperatorNameSyntax -> {
- append("\\operatorname{")
- append(node.name)
- append('}')
- }
-
- is SpecialSymbolSyntax -> when (node.kind) {
- SpecialSymbolSyntax.Kind.INFINITY -> append("\\infty")
- SpecialSymbolSyntax.Kind.SMALL_PI -> append("\\pi")
- }
-
- is OperandSyntax -> {
- if (node.parentheses) append("\\left(")
- render(node.operand)
- if (node.parentheses) append("\\right)")
- }
-
- is UnaryOperatorSyntax -> {
- render(node.prefix)
- append("\\,")
- render(node.operand)
- }
-
- is UnaryPlusSyntax -> {
- append('+')
- render(node.operand)
- }
-
- is UnaryMinusSyntax -> {
- append('-')
- render(node.operand)
- }
-
- is RadicalSyntax -> {
- append("\\sqrt")
- append('{')
- render(node.operand)
- append('}')
- }
-
- is ExponentSyntax -> if (node.useOperatorForm) {
- append("\\operatorname{exp}\\,")
- render(node.operand)
- } else {
- append("e^{")
- render(node.operand)
- append('}')
- }
-
- is SuperscriptSyntax -> {
- render(node.left)
- append("^{")
- render(node.right)
- append('}')
- }
-
- is SubscriptSyntax -> {
- render(node.left)
- append("_{")
- render(node.right)
- append('}')
- }
-
- is BinaryOperatorSyntax -> {
- render(node.prefix)
- append("\\left(")
- render(node.left)
- append(',')
- render(node.right)
- append("\\right)")
- }
-
- is BinaryPlusSyntax -> {
- render(node.left)
- append('+')
- render(node.right)
- }
-
- is BinaryMinusSyntax -> {
- render(node.left)
- append('-')
- render(node.right)
- }
-
- is FractionSyntax -> if (node.infix) {
- render(node.left)
- append('/')
- render(node.right)
- } else {
- append("\\frac{")
- render(node.left)
- append("}{")
- render(node.right)
- append('}')
- }
-
- is RadicalWithIndexSyntax -> {
- append("\\sqrt")
- append('[')
- render(node.left)
- append(']')
- append('{')
- render(node.right)
- append('}')
- }
-
- is MultiplicationSyntax -> {
- render(node.left)
- append(if (node.times) "\\times" else "\\,")
- render(node.right)
- }
- }
- }
-}
diff --git a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/MathMLSyntaxRenderer.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/MathMLSyntaxRenderer.kt
deleted file mode 100644
index 5439c42fa..000000000
--- a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/MathMLSyntaxRenderer.kt
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast.rendering
-
-import space.kscience.kmath.misc.UnstableKMathAPI
-
-/**
- * [SyntaxRenderer] implementation for MathML.
- *
- * The generated XML string is a valid MathML instance.
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public object MathMLSyntaxRenderer : SyntaxRenderer {
- override fun render(node: MathSyntax, output: Appendable) {
- output.append("")
- }
-
- /**
- * Renders a part of syntax returning a correct MathML tag not the whole MathML instance.
- */
- public fun renderPart(node: MathSyntax, output: Appendable): Unit = output.run {
- fun tag(tagName: String, vararg attr: Pair, block: () -> Unit = {}) {
- append('<')
- append(tagName)
-
- if (attr.isNotEmpty()) {
- append(' ')
- var count = 0
-
- for ((name, value) in attr) {
- if (++count > 1) append(' ')
- append(name)
- append("=\"")
- append(value)
- append('"')
- }
- }
-
- append('>')
- block()
- append("")
- append(tagName)
- append('>')
- }
-
- fun render(syntax: MathSyntax) = renderPart(syntax, output)
-
- when (node) {
- is NumberSyntax -> tag("mn") { append(node.string) }
- is SymbolSyntax -> tag("mi") { append(node.string) }
- is OperatorNameSyntax -> tag("mo") { append(node.name) }
-
- is SpecialSymbolSyntax -> when (node.kind) {
- SpecialSymbolSyntax.Kind.INFINITY -> tag("mo") { append("∞") }
- SpecialSymbolSyntax.Kind.SMALL_PI -> tag("mo") { append("π") }
- }
-
- is OperandSyntax -> if (node.parentheses) {
- tag("mfenced", "open" to "(", "close" to ")", "separators" to "") {
- render(node.operand)
- }
- } else {
- render(node.operand)
- }
-
- is UnaryOperatorSyntax -> {
- render(node.prefix)
- tag("mspace", "width" to "0.167em")
- render(node.operand)
- }
-
- is UnaryPlusSyntax -> {
- tag("mo") { append('+') }
- render(node.operand)
- }
-
- is UnaryMinusSyntax -> {
- tag("mo") { append("-") }
- render(node.operand)
- }
-
- is RadicalSyntax -> tag("msqrt") { render(node.operand) }
-
- is ExponentSyntax -> if (node.useOperatorForm) {
- tag("mo") { append("exp") }
- tag("mspace", "width" to "0.167em")
- render(node.operand)
- } else {
- tag("msup") {
- tag("mrow") {
- tag("mi") { append("e") }
- }
- tag("mrow") { render(node.operand) }
- }
- }
-
- is SuperscriptSyntax -> tag("msup") {
- tag("mrow") { render(node.left) }
- tag("mrow") { render(node.right) }
- }
-
- is SubscriptSyntax -> tag("msub") {
- tag("mrow") { render(node.left) }
- tag("mrow") { render(node.right) }
- }
-
- is BinaryOperatorSyntax -> {
- render(node.prefix)
-
- tag("mfenced", "open" to "(", "close" to ")", "separators" to "") {
- render(node.left)
- tag("mo") { append(',') }
- render(node.right)
- }
- }
-
- is BinaryPlusSyntax -> {
- render(node.left)
- tag("mo") { append('+') }
- render(node.right)
- }
-
- is BinaryMinusSyntax -> {
- render(node.left)
- tag("mo") { append('-') }
- render(node.right)
- }
-
- is FractionSyntax -> if (node.infix) {
- render(node.left)
- tag("mo") { append('/') }
- render(node.right)
- } else tag("mfrac") {
- tag("mrow") { render(node.left) }
- tag("mrow") { render(node.right) }
- }
-
- is RadicalWithIndexSyntax -> tag("mroot") {
- tag("mrow") { render(node.right) }
- tag("mrow") { render(node.left) }
- }
-
- is MultiplicationSyntax -> {
- render(node.left)
- if (node.times) tag("mo") { append("×") } else tag("mspace", "width" to "0.167em")
- render(node.right)
- }
- }
- }
-}
diff --git a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/MathRenderer.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/MathRenderer.kt
deleted file mode 100644
index 24bac425a..000000000
--- a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/MathRenderer.kt
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast.rendering
-
-import space.kscience.kmath.expressions.MST
-import space.kscience.kmath.misc.UnstableKMathAPI
-
-/**
- * Renders [MST] to [MathSyntax].
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public fun interface MathRenderer {
- /**
- * Renders [MST] to [MathSyntax].
- */
- public fun render(mst: MST): MathSyntax
-}
-
-/**
- * Implements [MST] render process with sequence of features.
- *
- * @property features The applied features.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public open class FeaturedMathRenderer(public val features: List) : MathRenderer {
- override fun render(mst: MST): MathSyntax {
- for (feature in features) feature.render(this, mst)?.let { return it }
- throw UnsupportedOperationException("Renderer $this has no appropriate feature to render node $mst.")
- }
-
- /**
- * Logical unit of [MST] rendering.
- */
- public fun interface RenderFeature {
- /**
- * Renders [MST] to [MathSyntax] in the context of owning renderer.
- */
- public fun render(renderer: FeaturedMathRenderer, node: MST): MathSyntax?
- }
-}
-
-/**
- * Extends [FeaturedMathRenderer] by adding post-processing stages.
- *
- * @property stages The applied stages.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public open class FeaturedMathRendererWithPostProcess(
- features: List,
- public val stages: List,
-) : FeaturedMathRenderer(features) {
- override fun render(mst: MST): MathSyntax {
- val res = super.render(mst)
- for (stage in stages) stage.perform(res)
- return res
- }
-
- /**
- * Logical unit of [MathSyntax] post-processing.
- */
- public fun interface PostProcessPhase {
- /**
- * Performs the specified action over [MathSyntax].
- */
- public fun perform(node: MathSyntax)
- }
-
- public companion object {
- /**
- * The default setup of [FeaturedMathRendererWithPostProcess].
- */
- public val Default: FeaturedMathRendererWithPostProcess = FeaturedMathRendererWithPostProcess(
- listOf(
- // Printing known operations
- BinaryPlus.Default,
- BinaryMinus.Default,
- UnaryPlus.Default,
- UnaryMinus.Default,
- Multiplication.Default,
- Fraction.Default,
- Power.Default,
- SquareRoot.Default,
- Exponent.Default,
- InverseTrigonometricOperations.Default,
- InverseHyperbolicOperations.Default,
-
- // Fallback option for unknown operations - printing them as operator
- BinaryOperator.Default,
- UnaryOperator.Default,
-
- // Pretty printing for some objects
- PrettyPrintFloats.Default,
- PrettyPrintIntegers.Default,
- PrettyPrintPi.Default,
-
- // Printing terminal nodes as string
- PrintNumeric,
- PrintSymbol,
- ),
- listOf(
- BetterExponent,
- BetterFraction,
- SimplifyParentheses.Default,
- BetterMultiplication,
- ),
- )
- }
-}
diff --git a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/MathSyntax.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/MathSyntax.kt
deleted file mode 100644
index 81b7d2afb..000000000
--- a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/MathSyntax.kt
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast.rendering
-
-import space.kscience.kmath.misc.UnstableKMathAPI
-
-/**
- * Syntax node for mathematical typography.
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public sealed class MathSyntax {
- /**
- * The parent node of this syntax node.
- */
- public var parent: MathSyntax? = null
-}
-
-/**
- * Terminal node, which should not have any children nodes.
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public sealed class TerminalSyntax : MathSyntax()
-
-/**
- * Node containing a certain operation.
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public sealed class OperationSyntax : MathSyntax() {
- /**
- * The operation token.
- */
- public abstract val operation: String
-}
-
-/**
- * Unary node, which has only one child.
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public sealed class UnarySyntax : OperationSyntax() {
- /**
- * The operand of this node.
- */
- public abstract val operand: MathSyntax
-}
-
-/**
- * Binary node, which has only two children.
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public sealed class BinarySyntax : OperationSyntax() {
- /**
- * The left-hand side operand.
- */
- public abstract val left: MathSyntax
-
- /**
- * The right-hand side operand.
- */
- public abstract val right: MathSyntax
-}
-
-/**
- * Represents a number.
- *
- * @property string The digits of number.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public data class NumberSyntax(public var string: String) : TerminalSyntax()
-
-/**
- * Represents a symbol.
- *
- * @property string The symbol.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public data class SymbolSyntax(public var string: String) : TerminalSyntax()
-
-/**
- * Represents special typing for operator name.
- *
- * @property name The operator name.
- * @see BinaryOperatorSyntax
- * @see UnaryOperatorSyntax
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public data class OperatorNameSyntax(public var name: String) : TerminalSyntax()
-
-/**
- * Represents a usage of special symbols (e.g., *∞*).
- *
- * @property kind The kind of symbol.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public data class SpecialSymbolSyntax(public var kind: Kind) : TerminalSyntax() {
- /**
- * The kind of symbol.
- */
- public enum class Kind {
- /**
- * The infinity (∞) symbol.
- */
- INFINITY,
-
- /**
- * The Pi (π) symbol.
- */
- SMALL_PI;
- }
-}
-
-/**
- * Represents operand of a certain operator wrapped with parentheses or not.
- *
- * @property operand The operand.
- * @property parentheses Whether the operand should be wrapped with parentheses.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public data class OperandSyntax(
- public val operand: MathSyntax,
- public var parentheses: Boolean,
-) : MathSyntax() {
- init {
- operand.parent = this
- }
-}
-
-/**
- * Represents unary, prefix operator syntax (like *f(x)*).
- *
- * @property prefix The prefix.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public data class UnaryOperatorSyntax(
- override val operation: String,
- public var prefix: MathSyntax,
- override val operand: OperandSyntax,
-) : UnarySyntax() {
- init {
- operand.parent = this
- }
-}
-
-/**
- * Represents prefix, unary plus operator (*+x*).
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public data class UnaryPlusSyntax(
- override val operation: String,
- override val operand: OperandSyntax,
-) : UnarySyntax() {
- init {
- operand.parent = this
- }
-}
-
-/**
- * Represents prefix, unary minus operator (*-x*).
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public data class UnaryMinusSyntax(
- override val operation: String,
- override val operand: OperandSyntax,
-) : UnarySyntax() {
- init {
- operand.parent = this
- }
-}
-
-/**
- * Represents radical with a node inside it (*√x*).
- *
- * @property operand The radicand.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public data class RadicalSyntax(
- override val operation: String,
- override val operand: MathSyntax,
-) : UnarySyntax() {
- init {
- operand.parent = this
- }
-}
-
-/**
- * Represents exponential function.
- *
- * @property operand The argument of function.
- * @property useOperatorForm `true` if operator form is used (*exp (x)*), `false` if exponentiation form is used
- * (*ex*).
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public data class ExponentSyntax(
- override val operation: String,
- override val operand: OperandSyntax,
- public var useOperatorForm: Boolean,
-) : UnarySyntax() {
- init {
- operand.parent = this
- }
-}
-
-/**
- * Represents a syntax node with superscript (*x2*).
- *
- * @property left The node.
- * @property right The superscript.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public data class SuperscriptSyntax(
- override val operation: String,
- override val left: MathSyntax,
- override val right: MathSyntax,
-) : BinarySyntax() {
- init {
- left.parent = this
- right.parent = this
- }
-}
-
-/**
- * Represents a syntax node with subscript (*xi*).
- *
- * @property left The node.
- * @property right The subscript.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public data class SubscriptSyntax(
- override val operation: String,
- override val left: MathSyntax,
- override val right: MathSyntax,
-) : BinarySyntax() {
- init {
- left.parent = this
- right.parent = this
- }
-}
-
-/**
- * Represents binary, prefix operator syntax (like *f(a, b)*).
- *
- * @property prefix The prefix.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public data class BinaryOperatorSyntax(
- override val operation: String,
- public var prefix: MathSyntax,
- override val left: MathSyntax,
- override val right: MathSyntax,
-) : BinarySyntax() {
- init {
- left.parent = this
- right.parent = this
- }
-}
-
-/**
- * Represents binary, infix addition (*42 + 42*).
- *
- * @param left The augend.
- * @param right The addend.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public data class BinaryPlusSyntax(
- override val operation: String,
- override val left: OperandSyntax,
- override val right: OperandSyntax,
-) : BinarySyntax() {
- init {
- left.parent = this
- right.parent = this
- }
-}
-
-/**
- * Represents binary, infix subtraction (*42 − 42*).
- *
- * @param left The minuend.
- * @param right The subtrahend.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public data class BinaryMinusSyntax(
- override val operation: String,
- override val left: OperandSyntax,
- override val right: OperandSyntax,
-) : BinarySyntax() {
- init {
- left.parent = this
- right.parent = this
- }
-}
-
-/**
- * Represents fraction with numerator and denominator.
- *
- * @property left The numerator.
- * @property right The denominator.
- * @property infix Whether infix (*1 / 2*) or normal (*½*) fraction should be made.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public data class FractionSyntax(
- override val operation: String,
- override val left: OperandSyntax,
- override val right: OperandSyntax,
- public var infix: Boolean,
-) : BinarySyntax() {
- init {
- left.parent = this
- right.parent = this
- }
-}
-
-/**
- * Represents radical syntax with index (*3√x*).
- *
- * @property left The index.
- * @property right The radicand.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public data class RadicalWithIndexSyntax(
- override val operation: String,
- override val left: MathSyntax,
- override val right: MathSyntax,
-) : BinarySyntax() {
- init {
- left.parent = this
- right.parent = this
- }
-}
-
-/**
- * Represents binary, infix multiplication in the form of coefficient (*2 x*) or with operator (*x × 2*).
- *
- * @property left The multiplicand.
- * @property right The multiplier.
- * @property times Whether the times (×) symbol should be used.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public data class MultiplicationSyntax(
- override val operation: String,
- override val left: OperandSyntax,
- override val right: OperandSyntax,
- public var times: Boolean,
-) : BinarySyntax() {
- init {
- left.parent = this
- right.parent = this
- }
-}
diff --git a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/SyntaxRenderer.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/SyntaxRenderer.kt
deleted file mode 100644
index 2f285c600..000000000
--- a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/SyntaxRenderer.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast.rendering
-
-import space.kscience.kmath.misc.UnstableKMathAPI
-
-/**
- * Abstraction of writing [MathSyntax] as a string of an actual markup language. Typical implementation should
- * involve traversal of MathSyntax with handling each subtype.
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public fun interface SyntaxRenderer {
- /**
- * Renders the [MathSyntax] to [output].
- */
- public fun render(node: MathSyntax, output: Appendable)
-}
-
-/**
- * Calls [SyntaxRenderer.render] with given [node] and a new [StringBuilder] instance, and returns its content.
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public fun SyntaxRenderer.renderWithStringBuilder(node: MathSyntax): String {
- val sb = StringBuilder()
- render(node, sb)
- return sb.toString()
-}
diff --git a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/features.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/features.kt
deleted file mode 100644
index a7a28d87f..000000000
--- a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/features.kt
+++ /dev/null
@@ -1,483 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast.rendering
-
-import space.kscience.kmath.ast.rendering.FeaturedMathRenderer.RenderFeature
-import space.kscience.kmath.expressions.MST
-import space.kscience.kmath.expressions.Symbol
-import space.kscience.kmath.misc.UnstableKMathAPI
-import space.kscience.kmath.operations.*
-import kotlin.reflect.KClass
-
-/**
- * Prints any [Symbol] as a [SymbolSyntax] containing the [Symbol.identity] of it.
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public val PrintSymbol: RenderFeature = RenderFeature { _, node ->
- if (node !is Symbol) null
- else SymbolSyntax(string = node.identity)
-}
-
-/**
- * Prints any [MST.Numeric] as a [NumberSyntax] containing the [Any.toString] result of it.
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public val PrintNumeric: RenderFeature = RenderFeature { _, node ->
- if (node !is MST.Numeric)
- null
- else
- NumberSyntax(string = node.value.toString())
-}
-
-@UnstableKMathAPI
-private fun printSignedNumberString(s: String): MathSyntax = if (s.startsWith('-'))
- UnaryMinusSyntax(
- operation = GroupOperations.MINUS_OPERATION,
- operand = OperandSyntax(
- operand = NumberSyntax(string = s.removePrefix("-")),
- parentheses = true,
- ),
- )
-else
- NumberSyntax(string = s)
-
-/**
- * Special printing for numeric types that are printed in form of
- * *('-'? (DIGIT+ ('.' DIGIT+)? ('E' '-'? DIGIT+)? | 'Infinity')) | 'NaN'*.
- *
- * @property types The suitable types.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public class PrettyPrintFloats(public val types: Set>) : RenderFeature {
- override fun render(renderer: FeaturedMathRenderer, node: MST): MathSyntax? {
- if (node !is MST.Numeric || node.value::class !in types) return null
-
- val toString = when (val v = node.value) {
- is Float -> v.multiplatformToString()
- is Double -> v.multiplatformToString()
- else -> v.toString()
- }.removeSuffix(".0")
-
- if (toString.contains('E', ignoreCase = true)) {
- val (beforeE, afterE) = toString.split('E', ignoreCase = true)
- val significand = beforeE.toDouble().toString().removeSuffix(".0")
- val exponent = afterE.toDouble().toString().removeSuffix(".0")
-
- return MultiplicationSyntax(
- operation = RingOperations.TIMES_OPERATION,
- left = OperandSyntax(operand = NumberSyntax(significand), parentheses = true),
- right = OperandSyntax(
- operand = SuperscriptSyntax(
- operation = PowerOperations.POW_OPERATION,
- left = NumberSyntax(string = "10"),
- right = printSignedNumberString(exponent),
- ),
- parentheses = true,
- ),
- times = true,
- )
- }
-
- if (toString.endsWith("Infinity")) {
- val infty = SpecialSymbolSyntax(SpecialSymbolSyntax.Kind.INFINITY)
-
- if (toString.startsWith('-'))
- return UnaryMinusSyntax(
- operation = GroupOperations.MINUS_OPERATION,
- operand = OperandSyntax(operand = infty, parentheses = true),
- )
-
- return infty
- }
-
- return printSignedNumberString(toString)
- }
-
- public companion object {
- /**
- * The default instance containing [Float], and [Double].
- */
- public val Default: PrettyPrintFloats = PrettyPrintFloats(setOf(Float::class, Double::class))
- }
-}
-
-/**
- * Special printing for numeric types that are printed in form of *'-'? DIGIT+*.
- *
- * @property types The suitable types.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public class PrettyPrintIntegers(public val types: Set>) : RenderFeature {
- override fun render(renderer: FeaturedMathRenderer, node: MST): MathSyntax? =
- if (node !is MST.Numeric || node.value::class !in types)
- null
- else
- printSignedNumberString(node.value.toString())
-
- public companion object {
- /**
- * The default instance containing [Byte], [Short], [Int], and [Long].
- */
- public val Default: PrettyPrintIntegers =
- PrettyPrintIntegers(setOf(Byte::class, Short::class, Int::class, Long::class))
- }
-}
-
-/**
- * Special printing for symbols meaning Pi.
- *
- * @property symbols The allowed symbols.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public class PrettyPrintPi(public val symbols: Set) : RenderFeature {
- override fun render(renderer: FeaturedMathRenderer, node: MST): MathSyntax? =
- if (node !is Symbol || node.identity !in symbols)
- null
- else
- SpecialSymbolSyntax(kind = SpecialSymbolSyntax.Kind.SMALL_PI)
-
- public companion object {
- /**
- * The default instance containing `pi`.
- */
- public val Default: PrettyPrintPi = PrettyPrintPi(setOf("pi"))
- }
-}
-
-/**
- * Abstract printing of unary operations that discards [MST] if their operation is not in [operations] or its type is
- * not [MST.Unary].
- *
- * @param operations the allowed operations. If `null`, any operation is accepted.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public abstract class Unary(public val operations: Collection?) : RenderFeature {
- /**
- * The actual render function specialized for [MST.Unary].
- */
- protected abstract fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax?
-
- public final override fun render(renderer: FeaturedMathRenderer, node: MST): MathSyntax? =
- if (node !is MST.Unary || operations != null && node.operation !in operations)
- null
- else
- renderUnary(renderer, node)
-}
-
-/**
- * Abstract printing of unary operations that discards [MST] if their operation is not in [operations] or its type is
- * not [MST.Binary].
- *
- * @property operations the allowed operations. If `null`, any operation is accepted.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public abstract class Binary(public val operations: Collection?) : RenderFeature {
- /**
- * The actual render function specialized for [MST.Binary].
- */
- protected abstract fun renderBinary(parent: FeaturedMathRenderer, node: MST.Binary): MathSyntax?
-
- public final override fun render(renderer: FeaturedMathRenderer, node: MST): MathSyntax? {
- if (node !is MST.Binary || operations != null && node.operation !in operations) return null
- return renderBinary(renderer, node)
- }
-}
-
-/**
- * Handles binary nodes by producing [BinaryPlusSyntax].
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public class BinaryPlus(operations: Collection?) : Binary(operations) {
- override fun renderBinary(parent: FeaturedMathRenderer, node: MST.Binary): MathSyntax =
- BinaryPlusSyntax(
- operation = node.operation,
- left = OperandSyntax(parent.render(node.left), true),
- right = OperandSyntax(parent.render(node.right), true),
- )
-
- public companion object {
- /**
- * The default instance configured with [GroupOperations.PLUS_OPERATION].
- */
- public val Default: BinaryPlus = BinaryPlus(setOf(GroupOperations.PLUS_OPERATION))
- }
-}
-
-/**
- * Handles binary nodes by producing [BinaryMinusSyntax].
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public class BinaryMinus(operations: Collection?) : Binary(operations) {
- override fun renderBinary(parent: FeaturedMathRenderer, node: MST.Binary): MathSyntax =
- BinaryMinusSyntax(
- operation = node.operation,
- left = OperandSyntax(operand = parent.render(node.left), parentheses = true),
- right = OperandSyntax(operand = parent.render(node.right), parentheses = true),
- )
-
- public companion object {
- /**
- * The default instance configured with [GroupOperations.MINUS_OPERATION].
- */
- public val Default: BinaryMinus = BinaryMinus(setOf(GroupOperations.MINUS_OPERATION))
- }
-}
-
-/**
- * Handles unary nodes by producing [UnaryPlusSyntax].
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public class UnaryPlus(operations: Collection?) : Unary(operations) {
- override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax = UnaryPlusSyntax(
- operation = node.operation,
- operand = OperandSyntax(operand = parent.render(node.value), parentheses = true),
- )
-
- public companion object {
- /**
- * The default instance configured with [GroupOperations.PLUS_OPERATION].
- */
- public val Default: UnaryPlus = UnaryPlus(setOf(GroupOperations.PLUS_OPERATION))
- }
-}
-
-/**
- * Handles binary nodes by producing [UnaryMinusSyntax].
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public class UnaryMinus(operations: Collection?) : Unary(operations) {
- override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax = UnaryMinusSyntax(
- operation = node.operation,
- operand = OperandSyntax(operand = parent.render(node.value), parentheses = true),
- )
-
- public companion object {
- /**
- * The default instance configured with [GroupOperations.MINUS_OPERATION].
- */
- public val Default: UnaryMinus = UnaryMinus(setOf(GroupOperations.MINUS_OPERATION))
- }
-}
-
-/**
- * Handles binary nodes by producing [FractionSyntax].
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public class Fraction(operations: Collection?) : Binary(operations) {
- override fun renderBinary(parent: FeaturedMathRenderer, node: MST.Binary): MathSyntax = FractionSyntax(
- operation = node.operation,
- left = OperandSyntax(operand = parent.render(node.left), parentheses = true),
- right = OperandSyntax(operand = parent.render(node.right), parentheses = true),
- infix = true,
- )
-
- public companion object {
- /**
- * The default instance configured with [FieldOperations.DIV_OPERATION].
- */
- public val Default: Fraction = Fraction(setOf(FieldOperations.DIV_OPERATION))
- }
-}
-
-/**
- * Handles binary nodes by producing [BinaryOperatorSyntax].
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public class BinaryOperator(operations: Collection?) : Binary(operations) {
- override fun renderBinary(parent: FeaturedMathRenderer, node: MST.Binary): MathSyntax =
- BinaryOperatorSyntax(
- operation = node.operation,
- prefix = OperatorNameSyntax(name = node.operation),
- left = parent.render(node.left),
- right = parent.render(node.right),
- )
-
- public companion object {
- /**
- * The default instance configured with `null`.
- */
- public val Default: BinaryOperator = BinaryOperator(null)
- }
-}
-
-/**
- * Handles unary nodes by producing [UnaryOperatorSyntax].
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public class UnaryOperator(operations: Collection?) : Unary(operations) {
- override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax =
- UnaryOperatorSyntax(
- operation = node.operation,
- prefix = OperatorNameSyntax(node.operation),
- operand = OperandSyntax(parent.render(node.value), true),
- )
-
- public companion object {
- /**
- * The default instance configured with `null`.
- */
- public val Default: UnaryOperator = UnaryOperator(null)
- }
-}
-
-/**
- * Handles binary nodes by producing [SuperscriptSyntax].
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public class Power(operations: Collection?) : Binary(operations) {
- override fun renderBinary(parent: FeaturedMathRenderer, node: MST.Binary): MathSyntax =
- SuperscriptSyntax(
- operation = node.operation,
- left = OperandSyntax(parent.render(node.left), true),
- right = OperandSyntax(parent.render(node.right), true),
- )
-
- public companion object {
- /**
- * The default instance configured with [PowerOperations.POW_OPERATION].
- */
- public val Default: Power = Power(setOf(PowerOperations.POW_OPERATION))
- }
-}
-
-/**
- * Handles binary nodes by producing [RadicalSyntax] with no index.
- */
-@UnstableKMathAPI
-public class SquareRoot(operations: Collection?) : Unary(operations) {
- override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax =
- RadicalSyntax(operation = node.operation, operand = parent.render(node.value))
-
- public companion object {
- /**
- * The default instance configured with [PowerOperations.SQRT_OPERATION].
- */
- public val Default: SquareRoot = SquareRoot(setOf(PowerOperations.SQRT_OPERATION))
- }
-}
-
-/**
- * Handles unary nodes by producing [ExponentSyntax].
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public class Exponent(operations: Collection?) : Unary(operations) {
- override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax = ExponentSyntax(
- operation = node.operation,
- operand = OperandSyntax(operand = parent.render(node.value), parentheses = true),
- useOperatorForm = true,
- )
-
- public companion object {
- /**
- * The default instance configured with [ExponentialOperations.EXP_OPERATION].
- */
- public val Default: Exponent = Exponent(setOf(ExponentialOperations.EXP_OPERATION))
- }
-}
-
-/**
- * Handles binary nodes by producing [MultiplicationSyntax].
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public class Multiplication(operations: Collection?) : Binary(operations) {
- override fun renderBinary(parent: FeaturedMathRenderer, node: MST.Binary): MathSyntax =
- MultiplicationSyntax(
- operation = node.operation,
- left = OperandSyntax(operand = parent.render(node.left), parentheses = true),
- right = OperandSyntax(operand = parent.render(node.right), parentheses = true),
- times = true,
- )
-
- public companion object {
- /**
- * The default instance configured with [RingOperations.TIMES_OPERATION].
- */
- public val Default: Multiplication = Multiplication(setOf(RingOperations.TIMES_OPERATION))
- }
-}
-
-/**
- * Handles binary nodes by producing inverse [UnaryOperatorSyntax] with *arc* prefix instead of *a*.
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public class InverseTrigonometricOperations(operations: Collection?) : Unary(operations) {
- override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax =
- UnaryOperatorSyntax(
- operation = node.operation,
- prefix = OperatorNameSyntax(name = node.operation.replaceFirst("a", "arc")),
- operand = OperandSyntax(operand = parent.render(node.value), parentheses = true),
- )
-
- public companion object {
- /**
- * The default instance configured with [TrigonometricOperations.ACOS_OPERATION],
- * [TrigonometricOperations.ASIN_OPERATION], [TrigonometricOperations.ATAN_OPERATION].
- */
- public val Default: InverseTrigonometricOperations = InverseTrigonometricOperations(setOf(
- TrigonometricOperations.ACOS_OPERATION,
- TrigonometricOperations.ASIN_OPERATION,
- TrigonometricOperations.ATAN_OPERATION,
- ))
- }
-}
-
-/**
- * Handles binary nodes by producing inverse [UnaryOperatorSyntax] with *ar* prefix instead of *a*.
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public class InverseHyperbolicOperations(operations: Collection?) : Unary(operations) {
- override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax =
- UnaryOperatorSyntax(
- operation = node.operation,
- prefix = OperatorNameSyntax(name = node.operation.replaceFirst("a", "ar")),
- operand = OperandSyntax(operand = parent.render(node.value), parentheses = true),
- )
-
- public companion object {
- /**
- * The default instance configured with [ExponentialOperations.ACOSH_OPERATION],
- * [ExponentialOperations.ASINH_OPERATION], and [ExponentialOperations.ATANH_OPERATION].
- */
- public val Default: InverseHyperbolicOperations = InverseHyperbolicOperations(setOf(
- ExponentialOperations.ACOSH_OPERATION,
- ExponentialOperations.ASINH_OPERATION,
- ExponentialOperations.ATANH_OPERATION,
- ))
- }
-}
diff --git a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/multiplatformToString.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/multiplatformToString.kt
deleted file mode 100644
index 3e33d6415..000000000
--- a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/multiplatformToString.kt
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast.rendering
-
-internal expect fun Double.multiplatformToString(): String
-internal expect fun Float.multiplatformToString(): String
diff --git a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/phases.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/phases.kt
deleted file mode 100644
index 3d05e03d6..000000000
--- a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/phases.kt
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast.rendering
-
-import space.kscience.kmath.ast.rendering.FeaturedMathRendererWithPostProcess.PostProcessPhase
-import space.kscience.kmath.misc.UnstableKMathAPI
-import space.kscience.kmath.operations.FieldOperations
-import space.kscience.kmath.operations.GroupOperations
-import space.kscience.kmath.operations.PowerOperations
-import space.kscience.kmath.operations.RingOperations
-
-/**
- * Removes unnecessary times (×) symbols from [MultiplicationSyntax].
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public val BetterMultiplication: PostProcessPhase = PostProcessPhase { node ->
- fun perform(node: MathSyntax): Unit = when (node) {
- is NumberSyntax -> Unit
- is SymbolSyntax -> Unit
- is OperatorNameSyntax -> Unit
- is SpecialSymbolSyntax -> Unit
- is OperandSyntax -> perform(node.operand)
-
- is UnaryOperatorSyntax -> {
- perform(node.prefix)
- perform(node.operand)
- }
-
- is UnaryPlusSyntax -> perform(node.operand)
- is UnaryMinusSyntax -> perform(node.operand)
- is RadicalSyntax -> perform(node.operand)
- is ExponentSyntax -> perform(node.operand)
-
- is SuperscriptSyntax -> {
- perform(node.left)
- perform(node.right)
- }
-
- is SubscriptSyntax -> {
- perform(node.left)
- perform(node.right)
- }
-
- is BinaryOperatorSyntax -> {
- perform(node.prefix)
- perform(node.left)
- perform(node.right)
- }
-
- is BinaryPlusSyntax -> {
- perform(node.left)
- perform(node.right)
- }
-
- is BinaryMinusSyntax -> {
- perform(node.left)
- perform(node.right)
- }
-
- is FractionSyntax -> {
- perform(node.left)
- perform(node.right)
- }
-
- is RadicalWithIndexSyntax -> {
- perform(node.left)
- perform(node.right)
- }
-
- is MultiplicationSyntax -> {
- node.times = node.right.operand is NumberSyntax && !node.right.parentheses
- || node.left.operand is NumberSyntax && node.right.operand is FractionSyntax
- || node.left.operand is NumberSyntax && node.right.operand is NumberSyntax
- || node.left.operand is NumberSyntax && node.right.operand is SuperscriptSyntax && node.right.operand.left is NumberSyntax
-
- perform(node.left)
- perform(node.right)
- }
- }
-
- perform(node)
-}
-
-/**
- * Chooses [FractionSyntax.infix] depending on the context.
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public val BetterFraction: PostProcessPhase = PostProcessPhase { node ->
- fun perform(node: MathSyntax, infix: Boolean = false): Unit = when (node) {
- is NumberSyntax -> Unit
- is SymbolSyntax -> Unit
- is OperatorNameSyntax -> Unit
- is SpecialSymbolSyntax -> Unit
- is OperandSyntax -> perform(node.operand, infix)
-
- is UnaryOperatorSyntax -> {
- perform(node.prefix, infix)
- perform(node.operand, infix)
- }
-
- is UnaryPlusSyntax -> perform(node.operand, infix)
- is UnaryMinusSyntax -> perform(node.operand, infix)
- is RadicalSyntax -> perform(node.operand, infix)
- is ExponentSyntax -> perform(node.operand, infix)
-
- is SuperscriptSyntax -> {
- perform(node.left, true)
- perform(node.right, true)
- }
-
- is SubscriptSyntax -> {
- perform(node.left, true)
- perform(node.right, true)
- }
-
- is BinaryOperatorSyntax -> {
- perform(node.prefix, infix)
- perform(node.left, infix)
- perform(node.right, infix)
- }
-
- is BinaryPlusSyntax -> {
- perform(node.left, infix)
- perform(node.right, infix)
- }
-
- is BinaryMinusSyntax -> {
- perform(node.left, infix)
- perform(node.right, infix)
- }
-
- is FractionSyntax -> {
- node.infix = infix
- perform(node.left, infix)
- perform(node.right, infix)
- }
-
- is RadicalWithIndexSyntax -> {
- perform(node.left, true)
- perform(node.right, true)
- }
-
- is MultiplicationSyntax -> {
- perform(node.left, infix)
- perform(node.right, infix)
- }
- }
-
- perform(node)
-}
-
-/**
- * Applies [ExponentSyntax.useOperatorForm] to [ExponentSyntax] when the operand contains a fraction, a
- * superscript or a subscript to improve readability.
- *
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public val BetterExponent: PostProcessPhase = PostProcessPhase { node ->
- fun perform(node: MathSyntax): Boolean {
- return when (node) {
- is NumberSyntax -> false
- is SymbolSyntax -> false
- is OperatorNameSyntax -> false
- is SpecialSymbolSyntax -> false
- is OperandSyntax -> perform(node.operand)
- is UnaryOperatorSyntax -> perform(node.prefix) || perform(node.operand)
- is UnaryPlusSyntax -> perform(node.operand)
- is UnaryMinusSyntax -> perform(node.operand)
- is RadicalSyntax -> true
-
- is ExponentSyntax -> {
- val r = perform(node.operand)
- node.useOperatorForm = r
- r
- }
-
- is SuperscriptSyntax -> true
- is SubscriptSyntax -> true
- is BinaryOperatorSyntax -> perform(node.prefix) || perform(node.left) || perform(node.right)
- is BinaryPlusSyntax -> perform(node.left) || perform(node.right)
- is BinaryMinusSyntax -> perform(node.left) || perform(node.right)
- is FractionSyntax -> true
- is RadicalWithIndexSyntax -> true
- is MultiplicationSyntax -> perform(node.left) || perform(node.right)
- }
- }
-
- perform(node)
-}
-
-/**
- * Removes unnecessary parentheses from [OperandSyntax].
- *
- * @property precedenceFunction Returns the precedence number for syntax node. Higher number is lower priority.
- * @author Iaroslav Postovalov
- */
-@UnstableKMathAPI
-public class SimplifyParentheses(public val precedenceFunction: (MathSyntax) -> Int) :
- PostProcessPhase {
- override fun perform(node: MathSyntax): Unit = when (node) {
- is NumberSyntax -> Unit
- is SymbolSyntax -> Unit
- is OperatorNameSyntax -> Unit
- is SpecialSymbolSyntax -> Unit
-
- is OperandSyntax -> {
- val isRightOfSuperscript =
- (node.parent is SuperscriptSyntax) && (node.parent as SuperscriptSyntax).right === node
-
- val precedence = precedenceFunction(node.operand)
-
- val needParenthesesByPrecedence = when (val parent = node.parent) {
- null -> false
-
- is BinarySyntax -> {
- val parentPrecedence = precedenceFunction(parent)
-
- parentPrecedence < precedence ||
- parentPrecedence == precedence && parentPrecedence != 0 && node === parent.right
- }
-
- else -> precedence > precedenceFunction(parent)
- }
-
- val isInsideExpOperator =
- node.parent is ExponentSyntax && (node.parent as ExponentSyntax).useOperatorForm
-
- val isOnOrUnderNormalFraction = node.parent is FractionSyntax && !((node.parent as FractionSyntax).infix)
-
- node.parentheses = !isRightOfSuperscript
- && (needParenthesesByPrecedence || node.parent is UnaryOperatorSyntax || isInsideExpOperator)
- && !isOnOrUnderNormalFraction
-
- perform(node.operand)
- }
-
- is UnaryOperatorSyntax -> {
- perform(node.prefix)
- perform(node.operand)
- }
-
- is UnaryPlusSyntax -> perform(node.operand)
- is UnaryMinusSyntax -> perform(node.operand)
- is RadicalSyntax -> perform(node.operand)
- is ExponentSyntax -> perform(node.operand)
-
- is SuperscriptSyntax -> {
- perform(node.left)
- perform(node.right)
- }
-
- is SubscriptSyntax -> {
- perform(node.left)
- perform(node.right)
- }
-
- is BinaryOperatorSyntax -> {
- perform(node.prefix)
- perform(node.left)
- perform(node.right)
- }
-
- is BinaryPlusSyntax -> {
- perform(node.left)
- perform(node.right)
- }
-
- is BinaryMinusSyntax -> {
- perform(node.left)
- perform(node.right)
- }
-
- is FractionSyntax -> {
- perform(node.left)
- perform(node.right)
- }
-
- is MultiplicationSyntax -> {
- perform(node.left)
- perform(node.right)
- }
-
- is RadicalWithIndexSyntax -> {
- perform(node.left)
- perform(node.right)
- }
- }
-
- public companion object {
- /**
- * The default configuration of [SimplifyParentheses] where power is 1, multiplicative operations are 2,
- * additive operations are 3.
- */
- public val Default: SimplifyParentheses = SimplifyParentheses {
- when (it) {
- is TerminalSyntax -> 0
- is UnarySyntax -> 2
-
- is BinarySyntax -> when (it.operation) {
- PowerOperations.POW_OPERATION -> 1
- RingOperations.TIMES_OPERATION -> 3
- FieldOperations.DIV_OPERATION -> 3
- GroupOperations.MINUS_OPERATION -> 4
- GroupOperations.PLUS_OPERATION -> 4
- else -> 0
- }
-
- else -> 0
- }
- }
- }
-}
diff --git a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/TestCompilerConsistencyWithInterpreter.kt b/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/TestCompilerConsistencyWithInterpreter.kt
deleted file mode 100644
index 802d4c10e..000000000
--- a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/TestCompilerConsistencyWithInterpreter.kt
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast
-
-import space.kscience.kmath.expressions.MstField
-import space.kscience.kmath.expressions.MstRing
-import space.kscience.kmath.expressions.Symbol.Companion.x
-import space.kscience.kmath.expressions.interpret
-import space.kscience.kmath.operations.DoubleField
-import space.kscience.kmath.operations.IntRing
-import space.kscience.kmath.operations.invoke
-import kotlin.test.Test
-import kotlin.test.assertEquals
-
-internal class TestCompilerConsistencyWithInterpreter {
- @Test
- fun intRing() = runCompilerTest {
- val mst = MstRing {
- binaryOperationFunction("+")(
- unaryOperationFunction("+")(
- (x - (2.toByte() + (scale(
- add(number(1), number(1)),
- 2.0,
- ) + 1.toByte()))) * 3.0 - 1.toByte()
- ),
-
- number(1),
- ) * number(2)
- }
-
- assertEquals(
- mst.interpret(IntRing, x to 3),
- mst.compile(IntRing, x to 3),
- )
- }
-
- @Test
- fun doubleField() = runCompilerTest {
- val mst = MstField {
- +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")(
- (3.0 - (x + (scale(add(number(1.0), number(1.0)), 2.0) + 1.0))) * 3 - 1.0
- + number(1),
- number(1) / 2 + number(2.0) * one,
- ) + zero
- }
-
- assertEquals(
- mst.interpret(DoubleField, x to 2.0),
- mst.compile(DoubleField, x to 2.0),
- )
- }
-}
diff --git a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/TestCompilerOperations.kt b/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/TestCompilerOperations.kt
deleted file mode 100644
index f5b1e2842..000000000
--- a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/TestCompilerOperations.kt
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast
-
-import space.kscience.kmath.expressions.MstExtendedField
-import space.kscience.kmath.expressions.Symbol.Companion.x
-import space.kscience.kmath.expressions.invoke
-import space.kscience.kmath.operations.DoubleField
-import space.kscience.kmath.operations.invoke
-import kotlin.test.Test
-import kotlin.test.assertEquals
-
-internal class TestCompilerOperations {
- @Test
- fun testUnaryPlus() = runCompilerTest {
- val expr = MstExtendedField { +x }.compileToExpression(DoubleField)
- assertEquals(2.0, expr(x to 2.0))
- }
-
- @Test
- fun testUnaryMinus() = runCompilerTest {
- val expr = MstExtendedField { -x }.compileToExpression(DoubleField)
- assertEquals(-2.0, expr(x to 2.0))
- }
-
- @Test
- fun testAdd() = runCompilerTest {
- val expr = MstExtendedField { x + x }.compileToExpression(DoubleField)
- assertEquals(4.0, expr(x to 2.0))
- }
-
- @Test
- fun testSine() = runCompilerTest {
- val expr = MstExtendedField { sin(x) }.compileToExpression(DoubleField)
- assertEquals(0.0, expr(x to 0.0))
- }
-
- @Test
- fun testCosine() = runCompilerTest {
- val expr = MstExtendedField { cos(x) }.compileToExpression(DoubleField)
- assertEquals(1.0, expr(x to 0.0))
- }
-
- @Test
- fun testSubtract() = runCompilerTest {
- val expr = MstExtendedField { x - x }.compileToExpression(DoubleField)
- assertEquals(0.0, expr(x to 2.0))
- }
-
- @Test
- fun testDivide() = runCompilerTest {
- val expr = MstExtendedField { x / x }.compileToExpression(DoubleField)
- assertEquals(1.0, expr(x to 2.0))
- }
-
- @Test
- fun testPower() = runCompilerTest {
- val expr = MstExtendedField { x pow 2 }.compileToExpression(DoubleField)
- assertEquals(4.0, expr(x to 2.0))
- }
-}
diff --git a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/TestCompilerVariables.kt b/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/TestCompilerVariables.kt
deleted file mode 100644
index 8d9a2301f..000000000
--- a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/TestCompilerVariables.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast
-
-import space.kscience.kmath.expressions.MstRing
-import space.kscience.kmath.expressions.Symbol.Companion.x
-import space.kscience.kmath.expressions.invoke
-import space.kscience.kmath.operations.IntRing
-import space.kscience.kmath.operations.invoke
-import kotlin.test.Test
-import kotlin.test.assertEquals
-import kotlin.test.assertFailsWith
-
-internal class TestCompilerVariables {
- @Test
- fun testVariable() = runCompilerTest {
- val expr = MstRing { x }.compileToExpression(IntRing)
- assertEquals(1, expr(x to 1))
- }
-
- @Test
- fun testUndefinedVariableFails() = runCompilerTest {
- val expr = MstRing { x }.compileToExpression(IntRing)
- assertFailsWith { expr() }
- }
-}
diff --git a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/TestParser.kt b/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/TestParser.kt
deleted file mode 100644
index 4c834a9ca..000000000
--- a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/TestParser.kt
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast
-
-import space.kscience.kmath.complex.Complex
-import space.kscience.kmath.complex.ComplexField
-import space.kscience.kmath.expressions.evaluate
-import space.kscience.kmath.operations.Algebra
-import space.kscience.kmath.operations.DoubleField
-import kotlin.test.Test
-import kotlin.test.assertEquals
-
-internal class TestParser {
- @Test
- fun evaluateParsedMst() {
- val mst = "2+2*(2+2)".parseMath()
- val res = ComplexField.evaluate(mst)
- assertEquals(Complex(10.0, 0.0), res)
- }
-
- @Test
- fun evaluateMstSymbol() {
- val mst = "i".parseMath()
- val res = ComplexField.evaluate(mst)
- assertEquals(ComplexField.i, res)
- }
-
-
- @Test
- fun evaluateMstUnary() {
- val mst = "sin(0)".parseMath()
- val res = DoubleField.evaluate(mst)
- assertEquals(0.0, res)
- }
-
- @Test
- fun evaluateMstBinary() {
- val magicalAlgebra = object : Algebra {
- override fun bindSymbolOrNull(value: String): String = value
-
- override fun unaryOperationFunction(operation: String): (arg: String) -> String {
- throw NotImplementedError()
- }
-
- override fun binaryOperationFunction(operation: String): (left: String, right: String) -> String =
- when (operation) {
- "magic" -> { left, right -> "$left ★ $right" }
- else -> throw NotImplementedError()
- }
- }
-
- val mst = "magic(a, b)".parseMath()
- val res = magicalAlgebra.evaluate(mst)
- assertEquals("a ★ b", res)
- }
-}
diff --git a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/TestParserPrecedence.kt b/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/TestParserPrecedence.kt
deleted file mode 100644
index 9776da45c..000000000
--- a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/TestParserPrecedence.kt
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast
-
-import space.kscience.kmath.expressions.evaluate
-import space.kscience.kmath.operations.DoubleField
-import kotlin.test.Test
-import kotlin.test.assertEquals
-
-internal class TestParserPrecedence {
- @Test
- fun test1(): Unit = assertEquals(6.0, f.evaluate("2*2+2".parseMath()))
-
- @Test
- fun test2(): Unit = assertEquals(6.0, f.evaluate("2+2*2".parseMath()))
-
- @Test
- fun test3(): Unit = assertEquals(10.0, f.evaluate("2^3+2".parseMath()))
-
- @Test
- fun test4(): Unit = assertEquals(10.0, f.evaluate("2+2^3".parseMath()))
-
- @Test
- fun test5(): Unit = assertEquals(16.0, f.evaluate("2^3*2".parseMath()))
-
- @Test
- fun test6(): Unit = assertEquals(16.0, f.evaluate("2*2^3".parseMath()))
-
- @Test
- fun test7(): Unit = assertEquals(18.0, f.evaluate("2+2^3*2".parseMath()))
-
- @Test
- fun test8(): Unit = assertEquals(18.0, f.evaluate("2*2^3+2".parseMath()))
-
- private companion object {
- private val f = DoubleField
- }
-}
diff --git a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/rendering/TestFeatures.kt b/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/rendering/TestFeatures.kt
deleted file mode 100644
index ae429d97e..000000000
--- a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/rendering/TestFeatures.kt
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast.rendering
-
-import space.kscience.kmath.ast.rendering.TestUtils.testLatex
-import space.kscience.kmath.expressions.MST.Numeric
-import kotlin.test.Test
-
-internal class TestFeatures {
- @Test
- fun printSymbolic() = testLatex("x", "x")
-
- @Test
- fun printNumeric() {
- val num = object : Number() {
- override fun toByte(): Byte = throw UnsupportedOperationException()
- override fun toChar(): Char = throw UnsupportedOperationException()
- override fun toDouble(): Double = throw UnsupportedOperationException()
- override fun toFloat(): Float = throw UnsupportedOperationException()
- override fun toInt(): Int = throw UnsupportedOperationException()
- override fun toLong(): Long = throw UnsupportedOperationException()
- override fun toShort(): Short = throw UnsupportedOperationException()
- override fun toString(): String = "foo"
- }
-
- testLatex(Numeric(num), "foo")
- }
-
- @Test
- fun prettyPrintFloats() {
- testLatex(Numeric(Double.NaN), "NaN")
- testLatex(Numeric(Double.POSITIVE_INFINITY), "\\infty")
- testLatex(Numeric(Double.NEGATIVE_INFINITY), "-\\infty")
- testLatex(Numeric(1.0), "1")
- testLatex(Numeric(-1.0), "-1")
- testLatex(Numeric(1.42), "1.42")
- testLatex(Numeric(-1.42), "-1.42")
- testLatex(Numeric(1.1e10), "1.1\\times10^{10}")
- testLatex(Numeric(1.1e-10), "1.1\\times10^{-10}")
- testLatex(Numeric(-1.1e-10), "-1.1\\times10^{-10}")
- testLatex(Numeric(-1.1e10), "-1.1\\times10^{10}")
- testLatex(Numeric(0.001), "0.001")
- testLatex(Numeric(0.0000001), "1\\times10^{-7}")
-
- testLatex(Numeric(Float.NaN), "NaN")
- testLatex(Numeric(Float.POSITIVE_INFINITY), "\\infty")
- testLatex(Numeric(Float.NEGATIVE_INFINITY), "-\\infty")
- testLatex(Numeric(1.0f), "1")
- testLatex(Numeric(-1.0f), "-1")
- testLatex(Numeric(1.42f), "1.42")
- testLatex(Numeric(-1.42f), "-1.42")
- testLatex(Numeric(1e10f), "1\\times10^{10}")
- testLatex(Numeric(1e-10f), "1\\times10^{-10}")
- testLatex(Numeric(-1e-10f), "-1\\times10^{-10}")
- testLatex(Numeric(-1e10f), "-1\\times10^{10}")
- testLatex(Numeric(0.001f), "0.001")
- testLatex(Numeric(0.0000001f), "1\\times10^{-7}")
- }
-
- @Test
- fun prettyPrintIntegers() {
- testLatex(Numeric(42), "42")
- testLatex(Numeric(-42), "-42")
- }
-
- @Test
- fun prettyPrintPi() {
- testLatex("pi", "\\pi")
- }
-
- @Test
- fun binaryPlus() = testLatex("2+2", "2+2")
-
- @Test
- fun binaryMinus() = testLatex("2-2", "2-2")
-
- @Test
- fun fraction() = testLatex("2/2", "\\frac{2}{2}")
-
- @Test
- fun binaryOperator() = testLatex("f(x, y)", "\\operatorname{f}\\left(x,y\\right)")
-
- @Test
- fun unaryOperator() = testLatex("f(x)", "\\operatorname{f}\\,\\left(x\\right)")
-
- @Test
- fun power() = testLatex("x^y", "x^{y}")
-
- @Test
- fun squareRoot() = testLatex("sqrt(x)", "\\sqrt{x}")
-
- @Test
- fun exponential() = testLatex("exp(x)", "e^{x}")
-
- @Test
- fun multiplication() = testLatex("x*1", "x\\times1")
-
- @Test
- fun inverseTrigonometric() {
- testLatex("asin(x)", "\\operatorname{arcsin}\\,\\left(x\\right)")
- testLatex("acos(x)", "\\operatorname{arccos}\\,\\left(x\\right)")
- testLatex("atan(x)", "\\operatorname{arctan}\\,\\left(x\\right)")
- }
-
- @Test
- fun inverseHyperbolic() {
- testLatex("asinh(x)", "\\operatorname{arsinh}\\,\\left(x\\right)")
- testLatex("acosh(x)", "\\operatorname{arcosh}\\,\\left(x\\right)")
- testLatex("atanh(x)", "\\operatorname{artanh}\\,\\left(x\\right)")
- }
-
-// @Test
-// fun unaryPlus() {
-// testLatex("+1", "+1")
-// testLatex("+1", "++1")
-// }
-}
diff --git a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/rendering/TestLatex.kt b/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/rendering/TestLatex.kt
deleted file mode 100644
index d8e432230..000000000
--- a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/rendering/TestLatex.kt
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast.rendering
-
-import space.kscience.kmath.ast.rendering.TestUtils.testLatex
-import space.kscience.kmath.expressions.MST
-import space.kscience.kmath.operations.GroupOperations
-import kotlin.test.Test
-
-internal class TestLatex {
- @Test
- fun number() = testLatex("42", "42")
-
- @Test
- fun symbol() = testLatex("x", "x")
-
- @Test
- fun operatorName() = testLatex("sin(1)", "\\operatorname{sin}\\,\\left(1\\right)")
-
- @Test
- fun specialSymbol() {
- testLatex(MST.Numeric(Double.POSITIVE_INFINITY), "\\infty")
- testLatex("pi", "\\pi")
- }
-
- @Test
- fun operand() {
- testLatex("sin(1)", "\\operatorname{sin}\\,\\left(1\\right)")
- testLatex("1+1", "1+1")
- }
-
- @Test
- fun unaryOperator() = testLatex("sin(1)", "\\operatorname{sin}\\,\\left(1\\right)")
-
- @Test
- fun unaryPlus() = testLatex(MST.Unary(GroupOperations.PLUS_OPERATION, MST.Numeric(1)), "+1")
-
- @Test
- fun unaryMinus() = testLatex("-x", "-x")
-
- @Test
- fun radical() = testLatex("sqrt(x)", "\\sqrt{x}")
-
- @Test
- fun superscript() = testLatex("x^y", "x^{y}")
-
- @Test
- fun subscript() = testLatex(SubscriptSyntax("", SymbolSyntax("x"), NumberSyntax("123")), "x_{123}")
-
- @Test
- fun binaryOperator() = testLatex("f(x, y)", "\\operatorname{f}\\left(x,y\\right)")
-
- @Test
- fun binaryPlus() = testLatex("x+x", "x+x")
-
- @Test
- fun binaryMinus() = testLatex("x-x", "x-x")
-
- @Test
- fun fraction() = testLatex("x/x", "\\frac{x}{x}")
-
- @Test
- fun radicalWithIndex() = testLatex(RadicalWithIndexSyntax("", SymbolSyntax("x"), SymbolSyntax("y")), "\\sqrt[x]{y}")
-
- @Test
- fun multiplication() {
- testLatex("x*1", "x\\times1")
- testLatex("1*x", "1\\,x")
- }
-}
diff --git a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/rendering/TestMathML.kt b/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/rendering/TestMathML.kt
deleted file mode 100644
index a7fcbc75b..000000000
--- a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/rendering/TestMathML.kt
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast.rendering
-
-import space.kscience.kmath.ast.rendering.TestUtils.testMathML
-import space.kscience.kmath.expressions.MST
-import space.kscience.kmath.operations.GroupOperations
-import kotlin.test.Test
-
-internal class TestMathML {
- @Test
- fun number() = testMathML("42", "42")
-
- @Test
- fun symbol() = testMathML("x", "x")
-
- @Test
- fun operatorName() = testMathML(
- "sin(1)",
- "sin1",
- )
-
- @Test
- fun specialSymbol() {
- testMathML(MST.Numeric(Double.POSITIVE_INFINITY), "∞")
- testMathML("pi", "π")
- }
-
- @Test
- fun operand() {
- testMathML(
- "sin(1)",
- "sin1",
- )
-
- testMathML("1+1", "1+1")
- }
-
- @Test
- fun unaryOperator() = testMathML(
- "sin(1)",
- "sin1",
- )
-
- @Test
- fun unaryPlus() =
- testMathML(MST.Unary(GroupOperations.PLUS_OPERATION, MST.Numeric(1)), "+1")
-
- @Test
- fun unaryMinus() = testMathML("-x", "-x")
-
- @Test
- fun radical() = testMathML("sqrt(x)", "x")
-
- @Test
- fun superscript() = testMathML("x^y", "xy")
-
- @Test
- fun subscript() = testMathML(
- SubscriptSyntax("", SymbolSyntax("x"), NumberSyntax("123")),
- "x123",
- )
-
- @Test
- fun binaryOperator() = testMathML(
- "f(x, y)",
- "fx,y",
- )
-
- @Test
- fun binaryPlus() = testMathML("x+x", "x+x")
-
- @Test
- fun binaryMinus() = testMathML("x-x", "x-x")
-
- @Test
- fun fraction() = testMathML("x/x", "xx")
-
- @Test
- fun radicalWithIndex() =
- testMathML(RadicalWithIndexSyntax("", SymbolSyntax("x"), SymbolSyntax("y")),
- "yx")
-
- @Test
- fun multiplication() {
- testMathML("x*1", "x×1")
- testMathML("1*x", "1x")
- }
-}
diff --git a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/rendering/TestStages.kt b/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/rendering/TestStages.kt
deleted file mode 100644
index 4485605a6..000000000
--- a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/rendering/TestStages.kt
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast.rendering
-
-import space.kscience.kmath.ast.rendering.TestUtils.testLatex
-import kotlin.test.Test
-
-internal class TestStages {
- @Test
- fun betterMultiplication() {
- testLatex("a*1", "a\\times1")
- testLatex("1*(2/3)", "1\\times\\left(\\frac{2}{3}\\right)")
- testLatex("1*1", "1\\times1")
- testLatex("2e10", "2\\times10^{10}")
- testLatex("2*x", "2\\,x")
- testLatex("2*(x+1)", "2\\,\\left(x+1\\right)")
- testLatex("x*y", "x\\,y")
- }
-
- @Test
- fun parentheses() {
- testLatex("(x+1)", "x+1")
- testLatex("x*x*x", "x\\,x\\,x")
- testLatex("(x+x)*x", "\\left(x+x\\right)\\,x")
- testLatex("x+x*x", "x+x\\,x")
- testLatex("x+x^x*x+x", "x+x^{x}\\,x+x")
- testLatex("(x+x)^x+x*x", "\\left(x+x\\right)^{x}+x\\,x")
- testLatex("x^(x+x)", "x^{x+x}")
- }
-
- @Test
- fun exponent() {
- testLatex("exp(x)", "e^{x}")
- testLatex("exp(x/2)", "\\operatorname{exp}\\,\\left(\\frac{x}{2}\\right)")
- testLatex("exp(x^2)", "\\operatorname{exp}\\,\\left(x^{2}\\right)")
- }
-
- @Test
- fun fraction() {
- testLatex("x/y", "\\frac{x}{y}")
- testLatex("x^(x/y)", "x^{x/y}")
- }
-}
diff --git a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/rendering/TestUtils.kt b/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/rendering/TestUtils.kt
deleted file mode 100644
index 6b418821b..000000000
--- a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/rendering/TestUtils.kt
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast.rendering
-
-import space.kscience.kmath.ast.parseMath
-import space.kscience.kmath.expressions.MST
-import kotlin.test.assertEquals
-
-internal object TestUtils {
- private fun mathSyntax(mst: MST) = FeaturedMathRendererWithPostProcess.Default.render(mst)
- private fun latex(mst: MST) = LatexSyntaxRenderer.renderWithStringBuilder(mathSyntax(mst))
- private fun mathML(mst: MST) = MathMLSyntaxRenderer.renderWithStringBuilder(mathSyntax(mst))
-
- internal fun testLatex(mst: MST, expectedLatex: String) = assertEquals(
- expected = expectedLatex,
- actual = latex(mst),
- )
-
- internal fun testLatex(expression: String, expectedLatex: String) = assertEquals(
- expected = expectedLatex,
- actual = latex(expression.parseMath()),
- )
-
- internal fun testLatex(expression: MathSyntax, expectedLatex: String) = assertEquals(
- expected = expectedLatex,
- actual = LatexSyntaxRenderer.renderWithStringBuilder(expression),
- )
-
- internal fun testMathML(mst: MST, expectedMathML: String) = assertEquals(
- expected = "",
- actual = mathML(mst),
- )
-
- internal fun testMathML(expression: String, expectedMathML: String) = assertEquals(
- expected = "",
- actual = mathML(expression.parseMath()),
- )
-
- internal fun testMathML(expression: MathSyntax, expectedMathML: String) = assertEquals(
- expected = "",
- actual = MathMLSyntaxRenderer.renderWithStringBuilder(expression),
- )
-}
diff --git a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/utils.kt b/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/utils.kt
deleted file mode 100644
index ef9f3145a..000000000
--- a/kmath-ast/src/commonTest/kotlin/space/kscience/kmath/ast/utils.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast
-
-import space.kscience.kmath.expressions.Expression
-import space.kscience.kmath.expressions.MST
-import space.kscience.kmath.expressions.Symbol
-import space.kscience.kmath.operations.DoubleField
-import space.kscience.kmath.operations.IntRing
-
-internal interface CompilerTestContext {
- fun MST.compileToExpression(algebra: IntRing): Expression
- fun MST.compile(algebra: IntRing, arguments: Map): Int
- fun MST.compile(algebra: IntRing, vararg arguments: Pair): Int = compile(algebra, mapOf(*arguments))
- fun MST.compileToExpression(algebra: DoubleField): Expression
- fun MST.compile(algebra: DoubleField, arguments: Map): Double
-
- fun MST.compile(algebra: DoubleField, vararg arguments: Pair): Double =
- compile(algebra, mapOf(*arguments))
-}
-
-internal expect inline fun runCompilerTest(action: CompilerTestContext.() -> Unit)
diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/ast/rendering/multiplatformToString.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/ast/rendering/multiplatformToString.kt
deleted file mode 100644
index 2e69a536f..000000000
--- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/ast/rendering/multiplatformToString.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.ast.rendering
-
-internal actual fun Double.multiplatformToString(): String {
- val d = this
- if (d >= 1e7 || d <= -1e7) return js("d.toExponential()") as String
- return toString()
-}
-
-internal actual fun Float.multiplatformToString(): String {
- val d = this
- if (d >= 1e7f || d <= -1e7f) return js("d.toExponential()") as String
- return toString()
-}
diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/estree.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/estree.kt
deleted file mode 100644
index 316fdeeff..000000000
--- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/estree.kt
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.estree
-
-import space.kscience.kmath.estree.internal.ESTreeBuilder
-import space.kscience.kmath.expressions.Expression
-import space.kscience.kmath.expressions.MST
-import space.kscience.kmath.expressions.MST.*
-import space.kscience.kmath.expressions.Symbol
-import space.kscience.kmath.expressions.invoke
-import space.kscience.kmath.internal.estree.BaseExpression
-import space.kscience.kmath.operations.Algebra
-import space.kscience.kmath.operations.NumericAlgebra
-import space.kscience.kmath.operations.bindSymbolOrNull
-
-@PublishedApi
-internal fun MST.compileWith(algebra: Algebra): Expression {
- fun ESTreeBuilder.visit(node: MST): BaseExpression = when (node) {
- is Symbol -> {
- val symbol = algebra.bindSymbolOrNull(node)
-
- if (symbol != null)
- constant(symbol)
- else
- variable(node.identity)
- }
-
- is Numeric -> constant(node.value)
-
- is Unary -> when {
- algebra is NumericAlgebra && node.value is Numeric -> constant(
- algebra.unaryOperationFunction(node.operation)(algebra.number((node.value as Numeric).value)))
-
- else -> call(algebra.unaryOperationFunction(node.operation), visit(node.value))
- }
-
- is Binary -> when {
- algebra is NumericAlgebra && node.left is Numeric && node.right is Numeric -> constant(
- algebra.binaryOperationFunction(node.operation).invoke(
- algebra.number((node.left as Numeric).value),
- algebra.number((node.right as Numeric).value)
- )
- )
-
- algebra is NumericAlgebra && node.left is Numeric -> call(
- algebra.leftSideNumberOperationFunction(node.operation),
- visit(node.left),
- visit(node.right),
- )
-
- algebra is NumericAlgebra && node.right is Numeric -> call(
- algebra.rightSideNumberOperationFunction(node.operation),
- visit(node.left),
- visit(node.right),
- )
-
- else -> call(
- algebra.binaryOperationFunction(node.operation),
- visit(node.left),
- visit(node.right),
- )
- }
- }
-
- return ESTreeBuilder { visit(this@compileWith) }.instance
-}
-
-/**
- * Create a compiled expression with given [MST] and given [algebra].
- */
-public fun MST.compileToExpression(algebra: Algebra): Expression = compileWith(algebra)
-
-
-/**
- * Compile given MST to expression and evaluate it against [arguments]
- */
-public inline fun MST.compile(algebra: Algebra, arguments: Map): T =
- compileToExpression(algebra).invoke(arguments)
-
-
-/**
- * Compile given MST to expression and evaluate it against [arguments]
- */
-public inline fun MST.compile(algebra: Algebra, vararg arguments: Pair): T =
- compileToExpression(algebra).invoke(*arguments)
diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/ESTreeBuilder.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/ESTreeBuilder.kt
deleted file mode 100644
index 850f20be7..000000000
--- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/ESTreeBuilder.kt
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.estree.internal
-
-import space.kscience.kmath.expressions.Expression
-import space.kscience.kmath.expressions.Symbol
-import space.kscience.kmath.internal.astring.generate
-import space.kscience.kmath.internal.estree.*
-
-internal class ESTreeBuilder(val bodyCallback: ESTreeBuilder.() -> BaseExpression) {
- private class GeneratedExpression(val executable: dynamic, val constants: Array) : Expression {
- @Suppress("UNUSED_VARIABLE")
- override fun invoke(arguments: Map): T {
- val e = executable
- val c = constants
- val a = js("{}")
- arguments.forEach { (key, value) -> a[key.identity] = value }
- return js("e(c, a)").unsafeCast()
- }
- }
-
- val instance: Expression by lazy {
- val node = Program(
- sourceType = "script",
- VariableDeclaration(
- kind = "var",
- VariableDeclarator(
- id = Identifier("executable"),
- init = FunctionExpression(
- params = arrayOf(Identifier("constants"), Identifier("arguments")),
- body = BlockStatement(ReturnStatement(bodyCallback())),
- ),
- ),
- ),
- )
-
- eval(generate(node))
- GeneratedExpression(js("executable"), constants.toTypedArray())
- }
-
- private val constants = mutableListOf()
-
- fun constant(value: Any?) = when {
- value == null || jsTypeOf(value) == "number" || jsTypeOf(value) == "string" || jsTypeOf(value) == "boolean" ->
- SimpleLiteral(value)
-
- jsTypeOf(value) == "undefined" -> Identifier("undefined")
-
- else -> {
- val idx = if (value in constants) constants.indexOf(value) else constants.also { it += value }.lastIndex
-
- MemberExpression(
- computed = true,
- optional = false,
- `object` = Identifier("constants"),
- property = SimpleLiteral(idx),
- )
- }
- }
-
- fun variable(name: String): BaseExpression = call(getOrFail, Identifier("arguments"), SimpleLiteral(name))
-
- fun call(function: Function, vararg args: BaseExpression): BaseExpression = SimpleCallExpression(
- optional = false,
- callee = constant(function),
- *args,
- )
-
- private companion object {
- @Suppress("UNUSED_VARIABLE")
- val getOrFail: (`object`: dynamic, key: String) -> dynamic = { `object`, key ->
- val k = key
- val o = `object`
-
- if (!(js("k in o") as Boolean))
- throw NoSuchElementException("Key $key is missing in the map.")
-
- js("o[k]")
- }
- }
-}
diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/astring/astring.typealises.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/astring/astring.typealises.kt
deleted file mode 100644
index c7faf73e0..000000000
--- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/astring/astring.typealises.kt
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.estree.internal.astring
-
-internal typealias Generator = Any
diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/astring/astring.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/astring/astring.kt
deleted file mode 100644
index c36860654..000000000
--- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/astring/astring.kt
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-@file:JsModule("astring")
-@file:JsNonModule
-
-package space.kscience.kmath.internal.astring
-
-import space.kscience.kmath.internal.estree.BaseNode
-
-internal external interface Options {
- var indent: String?
- get() = definedExternally
- set(value) = definedExternally
- var lineEnd: String?
- get() = definedExternally
- set(value) = definedExternally
- var startingIndentLevel: Number?
- get() = definedExternally
- set(value) = definedExternally
- var comments: Boolean?
- get() = definedExternally
- set(value) = definedExternally
- var generator: Any?
- get() = definedExternally
- set(value) = definedExternally
- var sourceMap: Any?
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external fun generate(node: BaseNode, options: Options /* Options & `T$0` */ = definedExternally): String
-
-internal external fun generate(node: BaseNode): String
-
-internal external var baseGenerator: Generator
diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/astring/astring.typealises.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/astring/astring.typealises.kt
deleted file mode 100644
index 0a5b059ba..000000000
--- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/astring/astring.typealises.kt
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.internal.astring
-
-internal typealias Generator = Any
diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/base64/base64.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/base64/base64.kt
deleted file mode 100644
index 26186c453..000000000
--- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/base64/base64.kt
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-@file:Suppress(
- "INTERFACE_WITH_SUPERCLASS",
- "OVERRIDING_FINAL_MEMBER",
- "RETURN_TYPE_MISMATCH_ON_OVERRIDE",
- "CONFLICTING_OVERLOADS",
- "NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING",
- "ObjectPropertyName",
- "ClassName",
-)
-@file:JsNonModule
-@file:JsModule("js-base64")
-
-package space.kscience.kmath.internal.base64
-
-import org.khronos.webgl.Uint8Array
-
-internal external var version: Any
-
-internal external var VERSION: Any
-
-internal external var btoaPolyfill: (bin: String) -> String
-
-internal external var _btoa: (bin: String) -> String
-
-internal external var fromUint8Array: (u8a: Uint8Array, urlsafe: Boolean) -> String
-
-internal external var utob: (u: String) -> String
-
-internal external var encode: (src: String, urlsafe: Boolean) -> String
-
-internal external var encodeURI: (src: String) -> String
-
-internal external var btou: (b: String) -> String
-
-internal external var atobPolyfill: (asc: String) -> String
-
-internal external var _atob: (asc: String) -> String
-
-internal external var toUint8Array: (a: String) -> Uint8Array
-
-internal external var decode: (src: String) -> String
-
-internal external var isValid: (src: Any) -> Boolean
-
-internal external var extendString: () -> Unit
-
-internal external var extendUint8Array: () -> Unit
-
-internal external var extendBuiltins: () -> Unit
diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/binaryen/index.binaryen.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/binaryen/index.binaryen.kt
deleted file mode 100644
index 13e3a49e2..000000000
--- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/binaryen/index.binaryen.kt
+++ /dev/null
@@ -1,2239 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-@file:Suppress(
- "INTERFACE_WITH_SUPERCLASS",
- "OVERRIDING_FINAL_MEMBER",
- "RETURN_TYPE_MISMATCH_ON_OVERRIDE",
- "CONFLICTING_OVERLOADS",
- "NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING",
- "PropertyName",
- "ClassName",
-)
-
-@file:JsModule("binaryen")
-@file:JsNonModule
-
-package space.kscience.kmath.internal.binaryen
-
-import org.khronos.webgl.Uint8Array
-import kotlin.js.Promise
-
-internal external var isReady: Boolean
-
-internal external var ready: Promise
-
-internal external var none: Type
-
-internal external var i32: Type
-
-internal external var i64: Type
-
-internal external var f32: Type
-
-internal external var f64: Type
-
-internal external var v128: Type
-
-internal external var funcref: Type
-
-internal external var anyref: Type
-
-internal external var nullref: Type
-
-internal external var exnref: Type
-
-internal external var unreachable: Type
-
-internal external var auto: Type
-
-internal external fun createType(types: Array): Type
-
-internal external fun expandType(type: Type): Array
-
-internal external enum class ExpressionIds {
- Invalid,
- Block,
- If,
- Loop,
- Break,
- Switch,
- Call,
- CallIndirect,
- LocalGet,
- LocalSet,
- GlobalGet,
- GlobalSet,
- Load,
- Store,
- Const,
- Unary,
- Binary,
- Select,
- Drop,
- Return,
- Host,
- Nop,
- Unreachable,
- AtomicCmpxchg,
- AtomicRMW,
- AtomicWait,
- AtomicNotify,
- AtomicFence,
- SIMDExtract,
- SIMDReplace,
- SIMDShuffle,
- SIMDTernary,
- SIMDShift,
- SIMDLoad,
- MemoryInit,
- DataDrop,
- MemoryCopy,
- MemoryFill,
- RefNull,
- RefIsNull,
- RefFunc,
- Try,
- Throw,
- Rethrow,
- BrOnExn,
- TupleMake,
- TupleExtract,
- Push,
- Pop
-}
-
-internal external var InvalidId: ExpressionIds
-
-internal external var BlockId: ExpressionIds
-
-internal external var IfId: ExpressionIds
-
-internal external var LoopId: ExpressionIds
-
-internal external var BreakId: ExpressionIds
-
-internal external var SwitchId: ExpressionIds
-
-internal external var CallId: ExpressionIds
-
-internal external var CallIndirectId: ExpressionIds
-
-internal external var LocalGetId: ExpressionIds
-
-internal external var LocalSetId: ExpressionIds
-
-internal external var GlobalGetId: ExpressionIds
-
-internal external var GlobalSetId: ExpressionIds
-
-internal external var LoadId: ExpressionIds
-
-internal external var StoreId: ExpressionIds
-
-internal external var ConstId: ExpressionIds
-
-internal external var UnaryId: ExpressionIds
-
-internal external var BinaryId: ExpressionIds
-
-internal external var SelectId: ExpressionIds
-
-internal external var DropId: ExpressionIds
-
-internal external var ReturnId: ExpressionIds
-
-internal external var HostId: ExpressionIds
-
-internal external var NopId: ExpressionIds
-
-internal external var UnreachableId: ExpressionIds
-
-internal external var AtomicCmpxchgId: ExpressionIds
-
-internal external var AtomicRMWId: ExpressionIds
-
-internal external var AtomicWaitId: ExpressionIds
-
-internal external var AtomicNotifyId: ExpressionIds
-
-internal external var AtomicFenceId: ExpressionIds
-
-internal external var SIMDExtractId: ExpressionIds
-
-internal external var SIMDReplaceId: ExpressionIds
-
-internal external var SIMDShuffleId: ExpressionIds
-
-internal external var SIMDTernaryId: ExpressionIds
-
-internal external var SIMDShiftId: ExpressionIds
-
-internal external var SIMDLoadId: ExpressionIds
-
-internal external var MemoryInitId: ExpressionIds
-
-internal external var DataDropId: ExpressionIds
-
-internal external var MemoryCopyId: ExpressionIds
-
-internal external var MemoryFillId: ExpressionIds
-
-internal external var RefNullId: ExpressionIds
-
-internal external var RefIsNullId: ExpressionIds
-
-internal external var RefFuncId: ExpressionIds
-
-internal external var TryId: ExpressionIds
-
-internal external var ThrowId: ExpressionIds
-
-internal external var RethrowId: ExpressionIds
-
-internal external var BrOnExnId: ExpressionIds
-
-internal external var TupleMakeId: ExpressionIds
-
-internal external var TupleExtractId: ExpressionIds
-
-internal external var PushId: ExpressionIds
-
-internal external var PopId: ExpressionIds
-
-internal external enum class ExternalKinds {
- Function,
- Table,
- Memory,
- Global,
- Event
-}
-
-internal external var ExternalFunction: ExternalKinds
-
-internal external var ExternalTable: ExternalKinds
-
-internal external var ExternalMemory: ExternalKinds
-
-internal external var ExternalGlobal: ExternalKinds
-
-internal external var ExternalEvent: ExternalKinds
-
-internal external enum class Features {
- MVP,
- Atomics,
- MutableGlobals,
- TruncSat,
- SIMD,
- BulkMemory,
- SignExt,
- ExceptionHandling,
- TailCall,
- ReferenceTypes,
- Multivalue,
- GC,
- Memory64,
- All
-}
-
-internal external enum class Operations {
- ClzInt32,
- CtzInt32,
- PopcntInt32,
- NegFloat32,
- AbsFloat32,
- CeilFloat32,
- FloorFloat32,
- TruncFloat32,
- NearestFloat32,
- SqrtFloat32,
- EqZInt32,
- ClzInt64,
- CtzInt64,
- PopcntInt64,
- NegFloat64,
- AbsFloat64,
- CeilFloat64,
- FloorFloat64,
- TruncFloat64,
- NearestFloat64,
- SqrtFloat64,
- EqZInt64,
- ExtendSInt32,
- ExtendUInt32,
- WrapInt64,
- TruncSFloat32ToInt32,
- TruncSFloat32ToInt64,
- TruncUFloat32ToInt32,
- TruncUFloat32ToInt64,
- TruncSFloat64ToInt32,
- TruncSFloat64ToInt64,
- TruncUFloat64ToInt32,
- TruncUFloat64ToInt64,
- TruncSatSFloat32ToInt32,
- TruncSatSFloat32ToInt64,
- TruncSatUFloat32ToInt32,
- TruncSatUFloat32ToInt64,
- TruncSatSFloat64ToInt32,
- TruncSatSFloat64ToInt64,
- TruncSatUFloat64ToInt32,
- TruncSatUFloat64ToInt64,
- ReinterpretFloat32,
- ReinterpretFloat64,
- ConvertSInt32ToFloat32,
- ConvertSInt32ToFloat64,
- ConvertUInt32ToFloat32,
- ConvertUInt32ToFloat64,
- ConvertSInt64ToFloat32,
- ConvertSInt64ToFloat64,
- ConvertUInt64ToFloat32,
- ConvertUInt64ToFloat64,
- PromoteFloat32,
- DemoteFloat64,
- ReinterpretInt32,
- ReinterpretInt64,
- ExtendS8Int32,
- ExtendS16Int32,
- ExtendS8Int64,
- ExtendS16Int64,
- ExtendS32Int64,
- AddInt32,
- SubInt32,
- MulInt32,
- DivSInt32,
- DivUInt32,
- RemSInt32,
- RemUInt32,
- AndInt32,
- OrInt32,
- XorInt32,
- ShlInt32,
- ShrUInt32,
- ShrSInt32,
- RotLInt32,
- RotRInt32,
- EqInt32,
- NeInt32,
- LtSInt32,
- LtUInt32,
- LeSInt32,
- LeUInt32,
- GtSInt32,
- GtUInt32,
- GeSInt32,
- GeUInt32,
- AddInt64,
- SubInt64,
- MulInt64,
- DivSInt64,
- DivUInt64,
- RemSInt64,
- RemUInt64,
- AndInt64,
- OrInt64,
- XorInt64,
- ShlInt64,
- ShrUInt64,
- ShrSInt64,
- RotLInt64,
- RotRInt64,
- EqInt64,
- NeInt64,
- LtSInt64,
- LtUInt64,
- LeSInt64,
- LeUInt64,
- GtSInt64,
- GtUInt64,
- GeSInt64,
- GeUInt64,
- AddFloat32,
- SubFloat32,
- MulFloat32,
- DivFloat32,
- CopySignFloat32,
- MinFloat32,
- MaxFloat32,
- EqFloat32,
- NeFloat32,
- LtFloat32,
- LeFloat32,
- GtFloat32,
- GeFloat32,
- AddFloat64,
- SubFloat64,
- MulFloat64,
- DivFloat64,
- CopySignFloat64,
- MinFloat64,
- MaxFloat64,
- EqFloat64,
- NeFloat64,
- LtFloat64,
- LeFloat64,
- GtFloat64,
- GeFloat64,
- MemorySize,
- MemoryGrow,
- AtomicRMWAdd,
- AtomicRMWSub,
- AtomicRMWAnd,
- AtomicRMWOr,
- AtomicRMWXor,
- AtomicRMWXchg,
- SplatVecI8x16,
- ExtractLaneSVecI8x16,
- ExtractLaneUVecI8x16,
- ReplaceLaneVecI8x16,
- SplatVecI16x8,
- ExtractLaneSVecI16x8,
- ExtractLaneUVecI16x8,
- ReplaceLaneVecI16x8,
- SplatVecI32x4,
- ExtractLaneVecI32x4,
- ReplaceLaneVecI32x4,
- SplatVecI64x2,
- ExtractLaneVecI64x2,
- ReplaceLaneVecI64x2,
- SplatVecF32x4,
- ExtractLaneVecF32x4,
- ReplaceLaneVecF32x4,
- SplatVecF64x2,
- ExtractLaneVecF64x2,
- ReplaceLaneVecF64x2,
- EqVecI8x16,
- NeVecI8x16,
- LtSVecI8x16,
- LtUVecI8x16,
- GtSVecI8x16,
- GtUVecI8x16,
- LeSVecI8x16,
- LeUVecI8x16,
- GeSVecI8x16,
- GeUVecI8x16,
- EqVecI16x8,
- NeVecI16x8,
- LtSVecI16x8,
- LtUVecI16x8,
- GtSVecI16x8,
- GtUVecI16x8,
- LeSVecI16x8,
- LeUVecI16x8,
- GeSVecI16x8,
- GeUVecI16x8,
- EqVecI32x4,
- NeVecI32x4,
- LtSVecI32x4,
- LtUVecI32x4,
- GtSVecI32x4,
- GtUVecI32x4,
- LeSVecI32x4,
- LeUVecI32x4,
- GeSVecI32x4,
- GeUVecI32x4,
- EqVecF32x4,
- NeVecF32x4,
- LtVecF32x4,
- GtVecF32x4,
- LeVecF32x4,
- GeVecF32x4,
- EqVecF64x2,
- NeVecF64x2,
- LtVecF64x2,
- GtVecF64x2,
- LeVecF64x2,
- GeVecF64x2,
- NotVec128,
- AndVec128,
- OrVec128,
- XorVec128,
- AndNotVec128,
- BitselectVec128,
- NegVecI8x16,
- AnyTrueVecI8x16,
- AllTrueVecI8x16,
- ShlVecI8x16,
- ShrSVecI8x16,
- ShrUVecI8x16,
- AddVecI8x16,
- AddSatSVecI8x16,
- AddSatUVecI8x16,
- SubVecI8x16,
- SubSatSVecI8x16,
- SubSatUVecI8x16,
- MulVecI8x16,
- MinSVecI8x16,
- MinUVecI8x16,
- MaxSVecI8x16,
- MaxUVecI8x16,
- NegVecI16x8,
- AnyTrueVecI16x8,
- AllTrueVecI16x8,
- ShlVecI16x8,
- ShrSVecI16x8,
- ShrUVecI16x8,
- AddVecI16x8,
- AddSatSVecI16x8,
- AddSatUVecI16x8,
- SubVecI16x8,
- SubSatSVecI16x8,
- SubSatUVecI16x8,
- MulVecI16x8,
- MinSVecI16x8,
- MinUVecI16x8,
- MaxSVecI16x8,
- MaxUVecI16x8,
- DotSVecI16x8ToVecI32x4,
- NegVecI32x4,
- AnyTrueVecI32x4,
- AllTrueVecI32x4,
- ShlVecI32x4,
- ShrSVecI32x4,
- ShrUVecI32x4,
- AddVecI32x4,
- SubVecI32x4,
- MulVecI32x4,
- MinSVecI32x4,
- MinUVecI32x4,
- MaxSVecI32x4,
- MaxUVecI32x4,
- NegVecI64x2,
- AnyTrueVecI64x2,
- AllTrueVecI64x2,
- ShlVecI64x2,
- ShrSVecI64x2,
- ShrUVecI64x2,
- AddVecI64x2,
- SubVecI64x2,
- AbsVecF32x4,
- NegVecF32x4,
- SqrtVecF32x4,
- QFMAVecF32x4,
- QFMSVecF32x4,
- AddVecF32x4,
- SubVecF32x4,
- MulVecF32x4,
- DivVecF32x4,
- MinVecF32x4,
- MaxVecF32x4,
- AbsVecF64x2,
- NegVecF64x2,
- SqrtVecF64x2,
- QFMAVecF64x2,
- QFMSVecF64x2,
- AddVecF64x2,
- SubVecF64x2,
- MulVecF64x2,
- DivVecF64x2,
- MinVecF64x2,
- MaxVecF64x2,
- TruncSatSVecF32x4ToVecI32x4,
- TruncSatUVecF32x4ToVecI32x4,
- TruncSatSVecF64x2ToVecI64x2,
- TruncSatUVecF64x2ToVecI64x2,
- ConvertSVecI32x4ToVecF32x4,
- ConvertUVecI32x4ToVecF32x4,
- ConvertSVecI64x2ToVecF64x2,
- ConvertUVecI64x2ToVecF64x2,
- LoadSplatVec8x16,
- LoadSplatVec16x8,
- LoadSplatVec32x4,
- LoadSplatVec64x2,
- LoadExtSVec8x8ToVecI16x8,
- LoadExtUVec8x8ToVecI16x8,
- LoadExtSVec16x4ToVecI32x4,
- LoadExtUVec16x4ToVecI32x4,
- LoadExtSVec32x2ToVecI64x2,
- LoadExtUVec32x2ToVecI64x2,
- NarrowSVecI16x8ToVecI8x16,
- NarrowUVecI16x8ToVecI8x16,
- NarrowSVecI32x4ToVecI16x8,
- NarrowUVecI32x4ToVecI16x8,
- WidenLowSVecI8x16ToVecI16x8,
- WidenHighSVecI8x16ToVecI16x8,
- WidenLowUVecI8x16ToVecI16x8,
- WidenHighUVecI8x16ToVecI16x8,
- WidenLowSVecI16x8ToVecI32x4,
- WidenHighSVecI16x8ToVecI32x4,
- WidenLowUVecI16x8ToVecI32x4,
- WidenHighUVecI16x8ToVecI32x4,
- SwizzleVec8x16
-}
-
-internal external var ClzInt32: Operations
-
-internal external var CtzInt32: Operations
-
-internal external var PopcntInt32: Operations
-
-internal external var NegFloat32: Operations
-
-internal external var AbsFloat32: Operations
-
-internal external var CeilFloat32: Operations
-
-internal external var FloorFloat32: Operations
-
-internal external var TruncFloat32: Operations
-
-internal external var NearestFloat32: Operations
-
-internal external var SqrtFloat32: Operations
-
-internal external var EqZInt32: Operations
-
-internal external var ClzInt64: Operations
-
-internal external var CtzInt64: Operations
-
-internal external var PopcntInt64: Operations
-
-internal external var NegFloat64: Operations
-
-internal external var AbsFloat64: Operations
-
-internal external var CeilFloat64: Operations
-
-internal external var FloorFloat64: Operations
-
-internal external var TruncFloat64: Operations
-
-internal external var NearestFloat64: Operations
-
-internal external var SqrtFloat64: Operations
-
-internal external var EqZInt64: Operations
-
-internal external var ExtendSInt32: Operations
-
-internal external var ExtendUInt32: Operations
-
-internal external var WrapInt64: Operations
-
-internal external var TruncSFloat32ToInt32: Operations
-
-internal external var TruncSFloat32ToInt64: Operations
-
-internal external var TruncUFloat32ToInt32: Operations
-
-internal external var TruncUFloat32ToInt64: Operations
-
-internal external var TruncSFloat64ToInt32: Operations
-
-internal external var TruncSFloat64ToInt64: Operations
-
-internal external var TruncUFloat64ToInt32: Operations
-
-internal external var TruncUFloat64ToInt64: Operations
-
-internal external var TruncSatSFloat32ToInt32: Operations
-
-internal external var TruncSatSFloat32ToInt64: Operations
-
-internal external var TruncSatUFloat32ToInt32: Operations
-
-internal external var TruncSatUFloat32ToInt64: Operations
-
-internal external var TruncSatSFloat64ToInt32: Operations
-
-internal external var TruncSatSFloat64ToInt64: Operations
-
-internal external var TruncSatUFloat64ToInt32: Operations
-
-internal external var TruncSatUFloat64ToInt64: Operations
-
-internal external var ReinterpretFloat32: Operations
-
-internal external var ReinterpretFloat64: Operations
-
-internal external var ConvertSInt32ToFloat32: Operations
-
-internal external var ConvertSInt32ToFloat64: Operations
-
-internal external var ConvertUInt32ToFloat32: Operations
-
-internal external var ConvertUInt32ToFloat64: Operations
-
-internal external var ConvertSInt64ToFloat32: Operations
-
-internal external var ConvertSInt64ToFloat64: Operations
-
-internal external var ConvertUInt64ToFloat32: Operations
-
-internal external var ConvertUInt64ToFloat64: Operations
-
-internal external var PromoteFloat32: Operations
-
-internal external var DemoteFloat64: Operations
-
-internal external var ReinterpretInt32: Operations
-
-internal external var ReinterpretInt64: Operations
-
-internal external var ExtendS8Int32: Operations
-
-internal external var ExtendS16Int32: Operations
-
-internal external var ExtendS8Int64: Operations
-
-internal external var ExtendS16Int64: Operations
-
-internal external var ExtendS32Int64: Operations
-
-internal external var AddInt32: Operations
-
-internal external var SubInt32: Operations
-
-internal external var MulInt32: Operations
-
-internal external var DivSInt32: Operations
-
-internal external var DivUInt32: Operations
-
-internal external var RemSInt32: Operations
-
-internal external var RemUInt32: Operations
-
-internal external var AndInt32: Operations
-
-internal external var OrInt32: Operations
-
-internal external var XorInt32: Operations
-
-internal external var ShlInt32: Operations
-
-internal external var ShrUInt32: Operations
-
-internal external var ShrSInt32: Operations
-
-internal external var RotLInt32: Operations
-
-internal external var RotRInt32: Operations
-
-internal external var EqInt32: Operations
-
-internal external var NeInt32: Operations
-
-internal external var LtSInt32: Operations
-
-internal external var LtUInt32: Operations
-
-internal external var LeSInt32: Operations
-
-internal external var LeUInt32: Operations
-
-internal external var GtSInt32: Operations
-
-internal external var GtUInt32: Operations
-
-internal external var GeSInt32: Operations
-
-internal external var GeUInt32: Operations
-
-internal external var AddInt64: Operations
-
-internal external var SubInt64: Operations
-
-internal external var MulInt64: Operations
-
-internal external var DivSInt64: Operations
-
-internal external var DivUInt64: Operations
-
-internal external var RemSInt64: Operations
-
-internal external var RemUInt64: Operations
-
-internal external var AndInt64: Operations
-
-internal external var OrInt64: Operations
-
-internal external var XorInt64: Operations
-
-internal external var ShlInt64: Operations
-
-internal external var ShrUInt64: Operations
-
-internal external var ShrSInt64: Operations
-
-internal external var RotLInt64: Operations
-
-internal external var RotRInt64: Operations
-
-internal external var EqInt64: Operations
-
-internal external var NeInt64: Operations
-
-internal external var LtSInt64: Operations
-
-internal external var LtUInt64: Operations
-
-internal external var LeSInt64: Operations
-
-internal external var LeUInt64: Operations
-
-internal external var GtSInt64: Operations
-
-internal external var GtUInt64: Operations
-
-internal external var GeSInt64: Operations
-
-internal external var GeUInt64: Operations
-
-internal external var AddFloat32: Operations
-
-internal external var SubFloat32: Operations
-
-internal external var MulFloat32: Operations
-
-internal external var DivFloat32: Operations
-
-internal external var CopySignFloat32: Operations
-
-internal external var MinFloat32: Operations
-
-internal external var MaxFloat32: Operations
-
-internal external var EqFloat32: Operations
-
-internal external var NeFloat32: Operations
-
-internal external var LtFloat32: Operations
-
-internal external var LeFloat32: Operations
-
-internal external var GtFloat32: Operations
-
-internal external var GeFloat32: Operations
-
-internal external var AddFloat64: Operations
-
-internal external var SubFloat64: Operations
-
-internal external var MulFloat64: Operations
-
-internal external var DivFloat64: Operations
-
-internal external var CopySignFloat64: Operations
-
-internal external var MinFloat64: Operations
-
-internal external var MaxFloat64: Operations
-
-internal external var EqFloat64: Operations
-
-internal external var NeFloat64: Operations
-
-internal external var LtFloat64: Operations
-
-internal external var LeFloat64: Operations
-
-internal external var GtFloat64: Operations
-
-internal external var GeFloat64: Operations
-
-internal external var MemorySize: Operations
-
-internal external var MemoryGrow: Operations
-
-internal external var AtomicRMWAdd: Operations
-
-internal external var AtomicRMWSub: Operations
-
-internal external var AtomicRMWAnd: Operations
-
-internal external var AtomicRMWOr: Operations
-
-internal external var AtomicRMWXor: Operations
-
-internal external var AtomicRMWXchg: Operations
-
-internal external var SplatVecI8x16: Operations
-
-internal external var ExtractLaneSVecI8x16: Operations
-
-internal external var ExtractLaneUVecI8x16: Operations
-
-internal external var ReplaceLaneVecI8x16: Operations
-
-internal external var SplatVecI16x8: Operations
-
-internal external var ExtractLaneSVecI16x8: Operations
-
-internal external var ExtractLaneUVecI16x8: Operations
-
-internal external var ReplaceLaneVecI16x8: Operations
-
-internal external var SplatVecI32x4: Operations
-
-internal external var ExtractLaneVecI32x4: Operations
-
-internal external var ReplaceLaneVecI32x4: Operations
-
-internal external var SplatVecI64x2: Operations
-
-internal external var ExtractLaneVecI64x2: Operations
-
-internal external var ReplaceLaneVecI64x2: Operations
-
-internal external var SplatVecF32x4: Operations
-
-internal external var ExtractLaneVecF32x4: Operations
-
-internal external var ReplaceLaneVecF32x4: Operations
-
-internal external var SplatVecF64x2: Operations
-
-internal external var ExtractLaneVecF64x2: Operations
-
-internal external var ReplaceLaneVecF64x2: Operations
-
-internal external var EqVecI8x16: Operations
-
-internal external var NeVecI8x16: Operations
-
-internal external var LtSVecI8x16: Operations
-
-internal external var LtUVecI8x16: Operations
-
-internal external var GtSVecI8x16: Operations
-
-internal external var GtUVecI8x16: Operations
-
-internal external var LeSVecI8x16: Operations
-
-internal external var LeUVecI8x16: Operations
-
-internal external var GeSVecI8x16: Operations
-
-internal external var GeUVecI8x16: Operations
-
-internal external var EqVecI16x8: Operations
-
-internal external var NeVecI16x8: Operations
-
-internal external var LtSVecI16x8: Operations
-
-internal external var LtUVecI16x8: Operations
-
-internal external var GtSVecI16x8: Operations
-
-internal external var GtUVecI16x8: Operations
-
-internal external var LeSVecI16x8: Operations
-
-internal external var LeUVecI16x8: Operations
-
-internal external var GeSVecI16x8: Operations
-
-internal external var GeUVecI16x8: Operations
-
-internal external var EqVecI32x4: Operations
-
-internal external var NeVecI32x4: Operations
-
-internal external var LtSVecI32x4: Operations
-
-internal external var LtUVecI32x4: Operations
-
-internal external var GtSVecI32x4: Operations
-
-internal external var GtUVecI32x4: Operations
-
-internal external var LeSVecI32x4: Operations
-
-internal external var LeUVecI32x4: Operations
-
-internal external var GeSVecI32x4: Operations
-
-internal external var GeUVecI32x4: Operations
-
-internal external var EqVecF32x4: Operations
-
-internal external var NeVecF32x4: Operations
-
-internal external var LtVecF32x4: Operations
-
-internal external var GtVecF32x4: Operations
-
-internal external var LeVecF32x4: Operations
-
-internal external var GeVecF32x4: Operations
-
-internal external var EqVecF64x2: Operations
-
-internal external var NeVecF64x2: Operations
-
-internal external var LtVecF64x2: Operations
-
-internal external var GtVecF64x2: Operations
-
-internal external var LeVecF64x2: Operations
-
-internal external var GeVecF64x2: Operations
-
-internal external var NotVec128: Operations
-
-internal external var AndVec128: Operations
-
-internal external var OrVec128: Operations
-
-internal external var XorVec128: Operations
-
-internal external var AndNotVec128: Operations
-
-internal external var BitselectVec128: Operations
-
-internal external var NegVecI8x16: Operations
-
-internal external var AnyTrueVecI8x16: Operations
-
-internal external var AllTrueVecI8x16: Operations
-
-internal external var ShlVecI8x16: Operations
-
-internal external var ShrSVecI8x16: Operations
-
-internal external var ShrUVecI8x16: Operations
-
-internal external var AddVecI8x16: Operations
-
-internal external var AddSatSVecI8x16: Operations
-
-internal external var AddSatUVecI8x16: Operations
-
-internal external var SubVecI8x16: Operations
-
-internal external var SubSatSVecI8x16: Operations
-
-internal external var SubSatUVecI8x16: Operations
-
-internal external var MulVecI8x16: Operations
-
-internal external var MinSVecI8x16: Operations
-
-internal external var MinUVecI8x16: Operations
-
-internal external var MaxSVecI8x16: Operations
-
-internal external var MaxUVecI8x16: Operations
-
-internal external var NegVecI16x8: Operations
-
-internal external var AnyTrueVecI16x8: Operations
-
-internal external var AllTrueVecI16x8: Operations
-
-internal external var ShlVecI16x8: Operations
-
-internal external var ShrSVecI16x8: Operations
-
-internal external var ShrUVecI16x8: Operations
-
-internal external var AddVecI16x8: Operations
-
-internal external var AddSatSVecI16x8: Operations
-
-internal external var AddSatUVecI16x8: Operations
-
-internal external var SubVecI16x8: Operations
-
-internal external var SubSatSVecI16x8: Operations
-
-internal external var SubSatUVecI16x8: Operations
-
-internal external var MulVecI16x8: Operations
-
-internal external var MinSVecI16x8: Operations
-
-internal external var MinUVecI16x8: Operations
-
-internal external var MaxSVecI16x8: Operations
-
-internal external var MaxUVecI16x8: Operations
-
-internal external var DotSVecI16x8ToVecI32x4: Operations
-
-internal external var NegVecI32x4: Operations
-
-internal external var AnyTrueVecI32x4: Operations
-
-internal external var AllTrueVecI32x4: Operations
-
-internal external var ShlVecI32x4: Operations
-
-internal external var ShrSVecI32x4: Operations
-
-internal external var ShrUVecI32x4: Operations
-
-internal external var AddVecI32x4: Operations
-
-internal external var SubVecI32x4: Operations
-
-internal external var MulVecI32x4: Operations
-
-internal external var MinSVecI32x4: Operations
-
-internal external var MinUVecI32x4: Operations
-
-internal external var MaxSVecI32x4: Operations
-
-internal external var MaxUVecI32x4: Operations
-
-internal external var NegVecI64x2: Operations
-
-internal external var AnyTrueVecI64x2: Operations
-
-internal external var AllTrueVecI64x2: Operations
-
-internal external var ShlVecI64x2: Operations
-
-internal external var ShrSVecI64x2: Operations
-
-internal external var ShrUVecI64x2: Operations
-
-internal external var AddVecI64x2: Operations
-
-internal external var SubVecI64x2: Operations
-
-internal external var AbsVecF32x4: Operations
-
-internal external var NegVecF32x4: Operations
-
-internal external var SqrtVecF32x4: Operations
-
-internal external var QFMAVecF32x4: Operations
-
-internal external var QFMSVecF32x4: Operations
-
-internal external var AddVecF32x4: Operations
-
-internal external var SubVecF32x4: Operations
-
-internal external var MulVecF32x4: Operations
-
-internal external var DivVecF32x4: Operations
-
-internal external var MinVecF32x4: Operations
-
-internal external var MaxVecF32x4: Operations
-
-internal external var AbsVecF64x2: Operations
-
-internal external var NegVecF64x2: Operations
-
-internal external var SqrtVecF64x2: Operations
-
-internal external var QFMAVecF64x2: Operations
-
-internal external var QFMSVecF64x2: Operations
-
-internal external var AddVecF64x2: Operations
-
-internal external var SubVecF64x2: Operations
-
-internal external var MulVecF64x2: Operations
-
-internal external var DivVecF64x2: Operations
-
-internal external var MinVecF64x2: Operations
-
-internal external var MaxVecF64x2: Operations
-
-internal external var TruncSatSVecF32x4ToVecI32x4: Operations
-
-internal external var TruncSatUVecF32x4ToVecI32x4: Operations
-
-internal external var TruncSatSVecF64x2ToVecI64x2: Operations
-
-internal external var TruncSatUVecF64x2ToVecI64x2: Operations
-
-internal external var ConvertSVecI32x4ToVecF32x4: Operations
-
-internal external var ConvertUVecI32x4ToVecF32x4: Operations
-
-internal external var ConvertSVecI64x2ToVecF64x2: Operations
-
-internal external var ConvertUVecI64x2ToVecF64x2: Operations
-
-internal external var LoadSplatVec8x16: Operations
-
-internal external var LoadSplatVec16x8: Operations
-
-internal external var LoadSplatVec32x4: Operations
-
-internal external var LoadSplatVec64x2: Operations
-
-internal external var LoadExtSVec8x8ToVecI16x8: Operations
-
-internal external var LoadExtUVec8x8ToVecI16x8: Operations
-
-internal external var LoadExtSVec16x4ToVecI32x4: Operations
-
-internal external var LoadExtUVec16x4ToVecI32x4: Operations
-
-internal external var LoadExtSVec32x2ToVecI64x2: Operations
-
-internal external var LoadExtUVec32x2ToVecI64x2: Operations
-
-internal external var NarrowSVecI16x8ToVecI8x16: Operations
-
-internal external var NarrowUVecI16x8ToVecI8x16: Operations
-
-internal external var NarrowSVecI32x4ToVecI16x8: Operations
-
-internal external var NarrowUVecI32x4ToVecI16x8: Operations
-
-internal external var WidenLowSVecI8x16ToVecI16x8: Operations
-
-internal external var WidenHighSVecI8x16ToVecI16x8: Operations
-
-internal external var WidenLowUVecI8x16ToVecI16x8: Operations
-
-internal external var WidenHighUVecI8x16ToVecI16x8: Operations
-
-internal external var WidenLowSVecI16x8ToVecI32x4: Operations
-
-internal external var WidenHighSVecI16x8ToVecI32x4: Operations
-
-internal external var WidenLowUVecI16x8ToVecI32x4: Operations
-
-internal external var WidenHighUVecI16x8ToVecI32x4: Operations
-
-internal external var SwizzleVec8x16: Operations
-
-internal external interface `T$2` {
- fun get(index: Number, type: Type): ExpressionRef
- fun set(index: Number, value: ExpressionRef): ExpressionRef
- fun tee(index: Number, value: ExpressionRef, type: Type): ExpressionRef
-}
-
-internal external interface `T$3` {
- fun get(name: String, type: Type): ExpressionRef
- fun set(name: String, value: ExpressionRef): ExpressionRef
-}
-
-internal external interface `T$4` {
- fun size(): ExpressionRef
- fun grow(value: ExpressionRef): ExpressionRef
- fun init(segment: Number, dest: ExpressionRef, offset: ExpressionRef, size: ExpressionRef): ExpressionRef
- fun copy(dest: ExpressionRef, source: ExpressionRef, size: ExpressionRef): ExpressionRef
- fun fill(dest: ExpressionRef, value: ExpressionRef, size: ExpressionRef): ExpressionRef
-}
-
-internal external interface `T$5` {
- fun drop(segment: Number): ExpressionRef
-}
-
-internal external interface `T$6` {
- fun f32(value: ExpressionRef): ExpressionRef
- fun f64(value: ExpressionRef): ExpressionRef
-}
-
-internal external interface `T$7` {
- fun add(offset: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun sub(offset: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun and(offset: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun or(offset: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun xor(offset: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun xchg(offset: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun cmpxchg(offset: Number, ptr: ExpressionRef, expected: ExpressionRef, replacement: ExpressionRef): ExpressionRef
-}
-
-internal external interface `T$8` {
- fun load(offset: Number, ptr: ExpressionRef): ExpressionRef
- fun load8_u(offset: Number, ptr: ExpressionRef): ExpressionRef
- fun load16_u(offset: Number, ptr: ExpressionRef): ExpressionRef
- fun store(offset: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun store8(offset: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun store16(offset: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- var rmw: `T$7`
- var rmw8_u: `T$7`
- var rmw16_u: `T$7`
- fun wait(ptr: ExpressionRef, expected: ExpressionRef, timeout: ExpressionRef): ExpressionRef
-}
-
-internal external interface `T$9` {
- fun load(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
- fun load8_s(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
- fun load8_u(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
- fun load16_s(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
- fun load16_u(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
- fun store(offset: Number, align: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun store8(offset: Number, align: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun store16(offset: Number, align: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun const(value: Number): ExpressionRef
- fun clz(value: ExpressionRef): ExpressionRef
- fun ctz(value: ExpressionRef): ExpressionRef
- fun popcnt(value: ExpressionRef): ExpressionRef
- fun eqz(value: ExpressionRef): ExpressionRef
- var trunc_s: `T$6`
- var trunc_u: `T$6`
- var trunc_s_sat: `T$6`
- var trunc_u_sat: `T$6`
- fun reinterpret(value: ExpressionRef): ExpressionRef
- fun extend8_s(value: ExpressionRef): ExpressionRef
- fun extend16_s(value: ExpressionRef): ExpressionRef
- fun wrap(value: ExpressionRef): ExpressionRef
- fun add(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun sub(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun mul(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun div_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun div_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun rem_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun rem_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun and(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun or(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun xor(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun shl(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun shr_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun shr_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun rotl(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun rotr(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun eq(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ne(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun lt_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun lt_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun le_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun le_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun gt_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun gt_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ge_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ge_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- var atomic: `T$8`
- fun pop(): ExpressionRef
-}
-
-internal external interface `T$10` {
- fun load(offset: Number, ptr: ExpressionRef): ExpressionRef
- fun load8_u(offset: Number, ptr: ExpressionRef): ExpressionRef
- fun load16_u(offset: Number, ptr: ExpressionRef): ExpressionRef
- fun load32_u(offset: Number, ptr: ExpressionRef): ExpressionRef
- fun store(offset: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun store8(offset: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun store16(offset: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun store32(offset: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- var rmw: `T$7`
- var rmw8_u: `T$7`
- var rmw16_u: `T$7`
- var rmw32_u: `T$7`
- fun wait(ptr: ExpressionRef, expected: ExpressionRef, timeout: ExpressionRef): ExpressionRef
-}
-
-internal external interface `T$11` {
- fun load(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
- fun load8_s(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
- fun load8_u(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
- fun load16_s(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
- fun load16_u(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
- fun load32_s(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
- fun load32_u(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
- fun store(offset: Number, align: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun store8(offset: Number, align: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun store16(offset: Number, align: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun store32(offset: Number, align: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun const(low: Number, high: Number): ExpressionRef
- fun clz(value: ExpressionRef): ExpressionRef
- fun ctz(value: ExpressionRef): ExpressionRef
- fun popcnt(value: ExpressionRef): ExpressionRef
- fun eqz(value: ExpressionRef): ExpressionRef
- var trunc_s: `T$6`
- var trunc_u: `T$6`
- var trunc_s_sat: `T$6`
- var trunc_u_sat: `T$6`
- fun reinterpret(value: ExpressionRef): ExpressionRef
- fun extend8_s(value: ExpressionRef): ExpressionRef
- fun extend16_s(value: ExpressionRef): ExpressionRef
- fun extend32_s(value: ExpressionRef): ExpressionRef
- fun extend_s(value: ExpressionRef): ExpressionRef
- fun extend_u(value: ExpressionRef): ExpressionRef
- fun add(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun sub(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun mul(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun div_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun div_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun rem_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun rem_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun and(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun or(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun xor(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun shl(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun shr_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun shr_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun rotl(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun rotr(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun eq(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ne(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun lt_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun lt_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun le_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun le_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun gt_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun gt_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ge_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ge_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- var atomic: `T$10`
- fun pop(): ExpressionRef
-}
-
-internal external interface `T$12` {
- fun load(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
- fun store(offset: Number, align: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun const(value: Number): ExpressionRef
- fun const_bits(value: Number): ExpressionRef
- fun neg(value: ExpressionRef): ExpressionRef
- fun abs(value: ExpressionRef): ExpressionRef
- fun ceil(value: ExpressionRef): ExpressionRef
- fun floor(value: ExpressionRef): ExpressionRef
- fun trunc(value: ExpressionRef): ExpressionRef
- fun nearest(value: ExpressionRef): ExpressionRef
- fun sqrt(value: ExpressionRef): ExpressionRef
- fun reinterpret(value: ExpressionRef): ExpressionRef
- var convert_s: `T$6`
- var convert_u: `T$6`
- fun demote(value: ExpressionRef): ExpressionRef
- fun add(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun sub(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun mul(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun div(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun copysign(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun min(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun max(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun eq(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ne(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun lt(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun le(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun gt(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ge(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun pop(): ExpressionRef
-}
-
-internal external interface `T$13` {
- fun load(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
- fun store(offset: Number, align: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun const(value: Number): ExpressionRef
- fun const_bits(low: Number, high: Number): ExpressionRef
- fun neg(value: ExpressionRef): ExpressionRef
- fun abs(value: ExpressionRef): ExpressionRef
- fun ceil(value: ExpressionRef): ExpressionRef
- fun floor(value: ExpressionRef): ExpressionRef
- fun trunc(value: ExpressionRef): ExpressionRef
- fun nearest(value: ExpressionRef): ExpressionRef
- fun sqrt(value: ExpressionRef): ExpressionRef
- fun reinterpret(value: ExpressionRef): ExpressionRef
- var convert_s: `T$6`
- var convert_u: `T$6`
- fun promote(value: ExpressionRef): ExpressionRef
- fun add(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun sub(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun mul(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun div(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun copysign(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun min(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun max(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun eq(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ne(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun lt(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun le(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun gt(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ge(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun pop(): ExpressionRef
-}
-
-internal external interface `T$14` {
- fun load(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
- fun store(offset: Number, align: Number, ptr: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun const(value: Number): ExpressionRef
- fun not(value: ExpressionRef): ExpressionRef
- fun and(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun or(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun xor(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun andnot(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun bitselect(left: ExpressionRef, right: ExpressionRef, cond: ExpressionRef): ExpressionRef
- fun pop(): ExpressionRef
-}
-
-internal external interface `T$15` {
- fun splat(value: ExpressionRef): ExpressionRef
- fun extract_lane_s(vec: ExpressionRef, index: ExpressionRef): ExpressionRef
- fun extract_lane_u(vec: ExpressionRef, index: ExpressionRef): ExpressionRef
- fun replace_lane(vec: ExpressionRef, index: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun eq(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ne(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun lt_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun lt_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun gt_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun gt_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun le_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun le_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ge_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ge_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun neg(value: ExpressionRef): ExpressionRef
- fun any_true(value: ExpressionRef): ExpressionRef
- fun all_true(value: ExpressionRef): ExpressionRef
- fun shl(vec: ExpressionRef, shift: ExpressionRef): ExpressionRef
- fun shr_s(vec: ExpressionRef, shift: ExpressionRef): ExpressionRef
- fun shr_u(vec: ExpressionRef, shift: ExpressionRef): ExpressionRef
- fun add(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun add_saturate_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun add_saturate_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun sub(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun sub_saturate_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun sub_saturate_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun mul(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun min_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun min_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun max_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun max_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun avgr_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun narrow_i16x8_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun narrow_i16x8_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
-}
-
-internal external interface `T$16` {
- fun splat(value: ExpressionRef): ExpressionRef
- fun extract_lane_s(vec: ExpressionRef, index: ExpressionRef): ExpressionRef
- fun extract_lane_u(vec: ExpressionRef, index: ExpressionRef): ExpressionRef
- fun replace_lane(vec: ExpressionRef, index: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun eq(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ne(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun lt_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun lt_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun gt_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun gt_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun le_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun le_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ge_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ge_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun neg(value: ExpressionRef): ExpressionRef
- fun any_true(value: ExpressionRef): ExpressionRef
- fun all_true(value: ExpressionRef): ExpressionRef
- fun shl(vec: ExpressionRef, shift: ExpressionRef): ExpressionRef
- fun shr_s(vec: ExpressionRef, shift: ExpressionRef): ExpressionRef
- fun shr_u(vec: ExpressionRef, shift: ExpressionRef): ExpressionRef
- fun add(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun add_saturate_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun add_saturate_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun sub(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun sub_saturate_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun sub_saturate_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun mul(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun min_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun min_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun max_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun max_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun avgr_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun narrow_i32x4_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun narrow_i32x4_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun widen_low_i8x16_s(value: ExpressionRef): ExpressionRef
- fun widen_high_i8x16_s(value: ExpressionRef): ExpressionRef
- fun widen_low_i8x16_u(value: ExpressionRef): ExpressionRef
- fun widen_high_i8x16_u(value: ExpressionRef): ExpressionRef
- fun load8x8_s(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
- fun load8x8_u(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
-}
-
-internal external interface `T$17` {
- fun splat(value: ExpressionRef): ExpressionRef
- fun extract_lane(vec: ExpressionRef, index: ExpressionRef): ExpressionRef
- fun replace_lane(vec: ExpressionRef, index: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun eq(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ne(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun lt_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun lt_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun gt_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun gt_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun le_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun le_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ge_s(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ge_u(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun neg(value: ExpressionRef): ExpressionRef
- fun any_true(value: ExpressionRef): ExpressionRef
- fun all_true(value: ExpressionRef): ExpressionRef
- fun shl(vec: ExpressionRef, shift: ExpressionRef): ExpressionRef
- fun shr_s(vec: ExpressionRef, shift: ExpressionRef): ExpressionRef
- fun shr_u(vec: ExpressionRef, shift: ExpressionRef): ExpressionRef
- fun add(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun sub(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun mul(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun trunc_sat_f32x4_s(value: ExpressionRef): ExpressionRef
- fun trunc_sat_f32x4_u(value: ExpressionRef): ExpressionRef
- fun widen_low_i16x8_s(value: ExpressionRef): ExpressionRef
- fun widen_high_i16x8_s(value: ExpressionRef): ExpressionRef
- fun widen_low_i16x8_u(value: ExpressionRef): ExpressionRef
- fun widen_high_i16x8_u(value: ExpressionRef): ExpressionRef
- fun load16x4_s(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
- fun load16x4_u(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
-}
-
-internal external interface `T$18` {
- fun splat(value: ExpressionRef): ExpressionRef
- fun extract_lane(vec: ExpressionRef, index: ExpressionRef): ExpressionRef
- fun replace_lane(vec: ExpressionRef, index: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun neg(value: ExpressionRef): ExpressionRef
- fun any_true(value: ExpressionRef): ExpressionRef
- fun all_true(value: ExpressionRef): ExpressionRef
- fun shl(vec: ExpressionRef, shift: ExpressionRef): ExpressionRef
- fun shr_s(vec: ExpressionRef, shift: ExpressionRef): ExpressionRef
- fun shr_u(vec: ExpressionRef, shift: ExpressionRef): ExpressionRef
- fun add(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun sub(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun trunc_sat_f64x2_s(value: ExpressionRef): ExpressionRef
- fun trunc_sat_f64x2_u(value: ExpressionRef): ExpressionRef
- fun load32x2_s(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
- fun load32x2_u(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
-}
-
-internal external interface `T$19` {
- fun splat(value: ExpressionRef): ExpressionRef
- fun extract_lane(vec: ExpressionRef, index: ExpressionRef): ExpressionRef
- fun replace_lane(vec: ExpressionRef, index: ExpressionRef, value: ExpressionRef): ExpressionRef
- fun eq(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ne(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun lt(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun gt(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun le(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun ge(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun abs(value: ExpressionRef): ExpressionRef
- fun neg(value: ExpressionRef): ExpressionRef
- fun sqrt(value: ExpressionRef): ExpressionRef
- fun qfma(a: ExpressionRef, b: ExpressionRef, c: ExpressionRef): ExpressionRef
- fun qfms(a: ExpressionRef, b: ExpressionRef, c: ExpressionRef): ExpressionRef
- fun add(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun sub(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun mul(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun div(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun min(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun max(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun convert_i32x4_s(value: ExpressionRef): ExpressionRef
- fun convert_i32x4_u(value: ExpressionRef): ExpressionRef
-}
-
-internal external interface `T$20` {
- fun shuffle(left: ExpressionRef, right: ExpressionRef, mask: Array): ExpressionRef
- fun swizzle(left: ExpressionRef, right: ExpressionRef): ExpressionRef
- fun load_splat(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
-}
-
-internal external interface `T$21` {
- fun load_splat(offset: Number, align: Number, ptr: ExpressionRef): ExpressionRef
-}
-
-internal external interface `T$22` {
- fun pop(): ExpressionRef
-}
-
-internal external interface `T$23` {
- fun `null`(): ExpressionRef
- fun is_null(value: ExpressionRef): ExpressionRef
- fun func(name: String): ExpressionRef
-}
-
-internal external interface `T$24` {
- fun notify(ptr: ExpressionRef, notifyCount: ExpressionRef): ExpressionRef
- fun fence(): ExpressionRef
-}
-
-internal external interface `T$25` {
- fun make(elements: Array): ExpressionRef
- fun extract(tuple: ExpressionRef, index: Number): ExpressionRef
-}
-
-internal external interface `T$26` {
- var imported: Boolean
- var segments: Array
-}
-
-internal external interface `T$27` {
- var binary: Uint8Array
- var sourceMap: String?
-}
-
-internal open external class Module {
- open var ptr: Number
- open fun block(label: String, children: Array, resultType: Type = definedExternally): ExpressionRef
- open fun `if`(
- condition: ExpressionRef,
- ifTrue: ExpressionRef,
- ifFalse: ExpressionRef = definedExternally
- ): ExpressionRef
-
- open fun loop(label: String, body: ExpressionRef): ExpressionRef
- open fun br(
- label: String,
- condition: ExpressionRef = definedExternally,
- value: ExpressionRef = definedExternally
- ): ExpressionRef
-
- open fun br_if(
- label: String,
- condition: ExpressionRef = definedExternally,
- value: ExpressionRef = definedExternally
- ): ExpressionRef
-
- open fun switch(
- labels: Array,
- defaultLabel: String,
- condition: ExpressionRef,
- value: ExpressionRef = definedExternally
- ): ExpressionRef
-
- open fun call(name: String, operands: Array, returnType: Type): ExpressionRef
- open fun return_call(name: String, operands: Array, returnType: Type): ExpressionRef
- open fun call_indirect(
- target: ExpressionRef,
- operands: Array,
- params: Type,
- results: Type
- ): ExpressionRef
-
- open fun return_call_indirect(
- target: ExpressionRef,
- operands: Array,
- params: Type,
- results: Type
- ): ExpressionRef
-
- open var local: `T$2`
- open var global: `T$3`
- open var memory: `T$4`
- open var data: `T$5`
- open var i32: `T$9`
- open var i64: `T$11`
- open var f32: `T$12`
- open var f64: `T$13`
- open var v128: `T$14`
- open var i8x16: `T$15`
- open var i16x8: `T$16`
- open var i32x4: `T$17`
- open var i64x2: `T$18`
- open var f32x4: `T$19`
- open var f64x2: `T$19`
- open var v8x16: `T$20`
- open var v16x8: `T$21`
- open var v32x4: `T$21`
- open var v64x2: `T$21`
- open var funcref: `T$22`
- open var anyref: `T$22`
- open var nullref: `T$22`
- open var exnref: `T$22`
- open var ref: `T$23`
- open var atomic: `T$24`
- open var tuple: `T$25`
- open fun `try`(body: ExpressionRef, catchBody: ExpressionRef): ExpressionRef
- open fun `throw`(event: String, operands: Array): ExpressionRef
- open fun rethrow(exnref: ExpressionRef): ExpressionRef
- open fun br_on_exn(label: String, event: String, exnref: ExpressionRef): ExpressionRef
- open fun push(value: ExpressionRef): ExpressionRef
- open fun select(
- condition: ExpressionRef,
- ifTrue: ExpressionRef,
- ifFalse: ExpressionRef,
- type: Type = definedExternally
- ): ExpressionRef
-
- open fun drop(value: ExpressionRef): ExpressionRef
- open fun `return`(value: ExpressionRef = definedExternally): ExpressionRef
- open fun host(op: Operations, name: String, operands: Array): ExpressionRef
- open fun nop(): ExpressionRef
- open fun unreachable(): ExpressionRef
- open fun addFunction(name: String, params: Type, results: Type, vars: Array, body: ExpressionRef): FunctionRef
- open fun getFunction(name: String): FunctionRef
- open fun removeFunction(name: String)
- open fun getNumFunctions(): Number
- open fun getFunctionByIndex(index: Number): FunctionRef
- open fun addGlobal(name: String, type: Type, mutable: Boolean, init: ExpressionRef): GlobalRef
- open fun getGlobal(name: String): GlobalRef
- open fun removeGlobal(name: String)
- open fun addEvent(name: String, attribute: Number, params: Type, results: Type): EventRef
- open fun getEvent(name: String): EventRef
- open fun removeEvent(name: String)
- open fun addFunctionImport(
- internalName: String,
- externalModuleName: String,
- externalBaseName: String,
- params: Type,
- results: Type
- )
-
- open fun addTableImport(internalName: String, externalModuleName: String, externalBaseName: String)
- open fun addMemoryImport(internalName: String, externalModuleName: String, externalBaseName: String)
- open fun addGlobalImport(
- internalName: String,
- externalModuleName: String,
- externalBaseName: String,
- globalType: Type
- )
-
- open fun addEventImport(
- internalName: String,
- externalModuleName: String,
- externalBaseName: String,
- attribute: Number,
- params: Type,
- results: Type
- )
-
- open fun addFunctionExport(internalName: String, externalName: String): ExportRef
- open fun addTableExport(internalName: String, externalName: String): ExportRef
- open fun addMemoryExport(internalName: String, externalName: String): ExportRef
- open fun addGlobalExport(internalName: String, externalName: String): ExportRef
- open fun removeExport(externalName: String)
- open fun getNumExports(): Number
- open fun getExportByIndex(index: Number): ExportRef
- open fun setFunctionTable(
- initial: Number,
- maximum: Number,
- funcNames: Array,
- offset: ExpressionRef = definedExternally
- )
-
- open fun getFunctionTable(): `T$26`
- open fun setMemory(
- initial: Number,
- maximum: Number,
- exportName: String? = definedExternally,
- segments: Array? = definedExternally,
- flags: Array? = definedExternally,
- shared: Boolean = definedExternally
- )
-
- open fun getNumMemorySegments(): Number
- open fun getMemorySegmentInfoByIndex(index: Number): MemorySegmentInfo
- open fun setStart(start: FunctionRef)
- open fun getFeatures(): Features
- open fun setFeatures(features: Features)
- open fun addCustomSection(name: String, contents: Uint8Array)
- open fun emitText(): String
- open fun emitStackIR(optimize: Boolean = definedExternally): String
- open fun emitAsmjs(): String
- open fun validate(): Number
- open fun optimize()
- open fun optimizeFunction(func: String)
- open fun optimizeFunction(func: FunctionRef)
- open fun runPasses(passes: Array)
- open fun runPassesOnFunction(func: String, passes: Array)
- open fun runPassesOnFunction(func: FunctionRef, passes: Array)
- open fun autoDrop()
- open fun dispose()
- open fun emitBinary(): Uint8Array
- open fun emitBinary(sourceMapUrl: String?): `T$27`
- open fun interpret()
- open fun addDebugInfoFileName(filename: String): Number
- open fun getDebugInfoFileName(index: Number): String?
- open fun setDebugLocation(
- func: FunctionRef,
- expr: ExpressionRef,
- fileIndex: Number,
- lineNumber: Number,
- columnNumber: Number
- )
-
- open fun copyExpression(expr: ExpressionRef): ExpressionRef
-}
-
-internal external interface MemorySegment {
- var offset: ExpressionRef
- var data: Uint8Array
- var passive: Boolean?
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface TableElement {
- var offset: ExpressionRef
- var names: Array
-}
-
-internal external fun wrapModule(ptr: Number): Module
-
-internal external fun getExpressionId(expression: ExpressionRef): Number
-
-internal external fun getExpressionType(expression: ExpressionRef): Type
-
-internal external fun getExpressionInfo(expression: ExpressionRef): ExpressionInfo
-
-internal external interface MemorySegmentInfo {
- var offset: ExpressionRef
- var data: Uint8Array
- var passive: Boolean
-}
-
-internal external interface ExpressionInfo {
- var id: ExpressionIds
- var type: Type
-}
-
-internal external interface BlockInfo : ExpressionInfo {
- var name: String
- var children: Array
-}
-
-internal external interface IfInfo : ExpressionInfo {
- var condition: ExpressionRef
- var ifTrue: ExpressionRef
- var ifFalse: ExpressionRef
-}
-
-internal external interface LoopInfo : ExpressionInfo {
- var name: String
- var body: ExpressionRef
-}
-
-internal external interface BreakInfo : ExpressionInfo {
- var name: String
- var condition: ExpressionRef
- var value: ExpressionRef
-}
-
-internal external interface SwitchInfo : ExpressionInfo {
- var names: Array
- var defaultName: String?
- var condition: ExpressionRef
- var value: ExpressionRef
-}
-
-internal external interface CallInfo : ExpressionInfo {
- var isReturn: Boolean
- var target: String
- var operands: Array
-}
-
-internal external interface CallIndirectInfo : ExpressionInfo {
- var isReturn: Boolean
- var target: ExpressionRef
- var operands: Array
-}
-
-internal external interface LocalGetInfo : ExpressionInfo {
- var index: Number
-}
-
-internal external interface LocalSetInfo : ExpressionInfo {
- var isTee: Boolean
- var index: Number
- var value: ExpressionRef
-}
-
-internal external interface GlobalGetInfo : ExpressionInfo {
- var name: String
-}
-
-internal external interface GlobalSetInfo : ExpressionInfo {
- var name: String
- var value: ExpressionRef
-}
-
-internal external interface LoadInfo : ExpressionInfo {
- var isAtomic: Boolean
- var isSigned: Boolean
- var offset: Number
- var bytes: Number
- var align: Number
- var ptr: ExpressionRef
-}
-
-internal external interface StoreInfo : ExpressionInfo {
- var isAtomic: Boolean
- var offset: Number
- var bytes: Number
- var align: Number
- var ptr: ExpressionRef
- var value: ExpressionRef
-}
-
-internal external interface `T$28` {
- var low: Number
- var high: Number
-}
-
-internal external interface ConstInfo : ExpressionInfo {
- var value: dynamic /* Number | `T$28` */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface UnaryInfo : ExpressionInfo {
- var op: Operations
- var value: ExpressionRef
-}
-
-internal external interface BinaryInfo : ExpressionInfo {
- var op: Operations
- var left: ExpressionRef
- var right: ExpressionRef
-}
-
-internal external interface SelectInfo : ExpressionInfo {
- var ifTrue: ExpressionRef
- var ifFalse: ExpressionRef
- var condition: ExpressionRef
-}
-
-internal external interface DropInfo : ExpressionInfo {
- var value: ExpressionRef
-}
-
-internal external interface ReturnInfo : ExpressionInfo {
- var value: ExpressionRef
-}
-
-internal external interface NopInfo : ExpressionInfo
-
-internal external interface UnreachableInfo : ExpressionInfo
-
-internal external interface HostInfo : ExpressionInfo {
- var op: Operations
- var nameOperand: String?
- var operands: Array
-}
-
-internal external interface AtomicRMWInfo : ExpressionInfo {
- var op: Operations
- var bytes: Number
- var offset: Number
- var ptr: ExpressionRef
- var value: ExpressionRef
-}
-
-internal external interface AtomicCmpxchgInfo : ExpressionInfo {
- var bytes: Number
- var offset: Number
- var ptr: ExpressionRef
- var expected: ExpressionRef
- var replacement: ExpressionRef
-}
-
-internal external interface AtomicWaitInfo : ExpressionInfo {
- var ptr: ExpressionRef
- var expected: ExpressionRef
- var timeout: ExpressionRef
- var expectedType: Type
-}
-
-internal external interface AtomicNotifyInfo : ExpressionInfo {
- var ptr: ExpressionRef
- var notifyCount: ExpressionRef
-}
-
-internal external interface AtomicFenceInfo : ExpressionInfo {
- var order: Number
-}
-
-internal external interface SIMDExtractInfo : ExpressionInfo {
- var op: Operations
- var vec: ExpressionRef
- var index: ExpressionRef
-}
-
-internal external interface SIMDReplaceInfo : ExpressionInfo {
- var op: Operations
- var vec: ExpressionRef
- var index: ExpressionRef
- var value: ExpressionRef
-}
-
-internal external interface SIMDShuffleInfo : ExpressionInfo {
- var left: ExpressionRef
- var right: ExpressionRef
- var mask: Array
-}
-
-internal external interface SIMDTernaryInfo : ExpressionInfo {
- var op: Operations
- var a: ExpressionRef
- var b: ExpressionRef
- var c: ExpressionRef
-}
-
-internal external interface SIMDShiftInfo : ExpressionInfo {
- var op: Operations
- var vec: ExpressionRef
- var shift: ExpressionRef
-}
-
-internal external interface SIMDLoadInfo : ExpressionInfo {
- var op: Operations
- var offset: Number
- var align: Number
- var ptr: ExpressionRef
-}
-
-internal external interface MemoryInitInfo : ExpressionInfo {
- var segment: Number
- var dest: ExpressionRef
- var offset: ExpressionRef
- var size: ExpressionRef
-}
-
-internal external interface MemoryDropInfo : ExpressionInfo {
- var segment: Number
-}
-
-internal external interface MemoryCopyInfo : ExpressionInfo {
- var dest: ExpressionRef
- var source: ExpressionRef
- var size: ExpressionRef
-}
-
-internal external interface MemoryFillInfo : ExpressionInfo {
- var dest: ExpressionRef
- var value: ExpressionRef
- var size: ExpressionRef
-}
-
-internal external interface RefNullInfo : ExpressionInfo
-
-internal external interface RefIsNullInfo : ExpressionInfo {
- var value: ExpressionRef
-}
-
-internal external interface RefFuncInfo : ExpressionInfo {
- var func: String
-}
-
-internal external interface TryInfo : ExpressionInfo {
- var body: ExpressionRef
- var catchBody: ExpressionRef
-}
-
-internal external interface ThrowInfo : ExpressionInfo {
- var event: String
- var operands: Array
-}
-
-internal external interface RethrowInfo : ExpressionInfo {
- var exnref: ExpressionRef
-}
-
-internal external interface BrOnExnInfo : ExpressionInfo {
- var name: String
- var event: String
- var exnref: ExpressionRef
-}
-
-internal external interface PopInfo : ExpressionInfo
-
-internal external interface PushInfo : ExpressionInfo {
- var value: ExpressionRef
-}
-
-internal external fun getFunctionInfo(func: FunctionRef): FunctionInfo
-
-internal external interface FunctionInfo {
- var name: String
- var module: String?
- var base: String?
- var params: Type
- var results: Type
- var vars: Array
- var body: ExpressionRef
-}
-
-internal external fun getGlobalInfo(global: GlobalRef): GlobalInfo
-
-internal external interface GlobalInfo {
- var name: String
- var module: String?
- var base: String?
- var type: Type
- var mutable: Boolean
- var init: ExpressionRef
-}
-
-internal external fun getExportInfo(export_: ExportRef): ExportInfo
-
-internal external interface ExportInfo {
- var kind: ExternalKinds
- var name: String
- var value: String
-}
-
-internal external fun getEventInfo(event: EventRef): EventInfo
-
-internal external interface EventInfo {
- var name: String
- var module: String?
- var base: String?
- var attribute: Number
- var params: Type
- var results: Type
-}
-
-internal external fun getSideEffects(expr: ExpressionRef, features: Features): SideEffects
-
-internal external enum class SideEffects {
- None,
- Branches,
- Calls,
- ReadsLocal,
- WritesLocal,
- ReadsGlobal,
- WritesGlobal,
- ReadsMemory,
- WritesMemory,
- ImplicitTrap,
- IsAtomic,
- Throws,
- Any
-}
-
-internal external fun emitText(expression: ExpressionRef): String
-
-internal external fun emitText(expression: Module): String
-
-internal external fun readBinary(data: Uint8Array): Module
-
-internal external fun parseText(text: String): Module
-
-internal external fun getOptimizeLevel(): Number
-
-internal external fun setOptimizeLevel(level: Number): Number
-
-internal external fun getShrinkLevel(): Number
-
-internal external fun setShrinkLevel(level: Number): Number
-
-internal external fun getDebugInfo(): Boolean
-
-internal external fun setDebugInfo(on: Boolean)
-
-internal external fun getLowMemoryUnused(): Boolean
-
-internal external fun setLowMemoryUnused(on: Boolean)
-
-internal external fun getPassArgument(key: String): String?
-
-internal external fun setPassArgument(key: String, value: String?)
-
-internal external fun clearPassArguments()
-
-internal external fun getAlwaysInlineMaxSize(): Number
-
-internal external fun setAlwaysInlineMaxSize(size: Number)
-
-internal external fun getFlexibleInlineMaxSize(): Number
-
-internal external fun setFlexibleInlineMaxSize(size: Number)
-
-internal external fun getOneCallerInlineMaxSize(): Number
-
-internal external fun setOneCallerInlineMaxSize(size: Number)
-
-internal external fun exit(status: Number)
-
-internal open external class Relooper(module: Module) {
- open fun addBlock(expression: ExpressionRef): RelooperBlockRef
- open fun addBranch(from: RelooperBlockRef, to: RelooperBlockRef, condition: ExpressionRef, code: ExpressionRef)
- open fun addBlockWithSwitch(code: ExpressionRef, condition: ExpressionRef): RelooperBlockRef
- open fun addBranchForSwitch(
- from: RelooperBlockRef,
- to: RelooperBlockRef,
- indexes: Array,
- code: ExpressionRef
- )
-
- open fun renderAndDispose(entry: RelooperBlockRef, labelHelper: Number): ExpressionRef
-}
diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/binaryen/index.binaryen.typealiases.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/binaryen/index.binaryen.typealiases.kt
deleted file mode 100644
index 8e449627c..000000000
--- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/binaryen/index.binaryen.typealiases.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-@file:Suppress("PackageDirectoryMismatch", "NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING", "KDocMissingDocumentation")
-
-package space.kscience.kmath.internal.binaryen
-
-internal typealias Type = Number
-internal typealias ExpressionRef = Number
-internal typealias FunctionRef = Number
-internal typealias GlobalRef = Number
-internal typealias ExportRef = Number
-internal typealias EventRef = Number
-internal typealias RelooperBlockRef = Number
diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/emitter/emitter.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/emitter/emitter.kt
deleted file mode 100644
index d85857de8..000000000
--- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/emitter/emitter.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.internal.emitter
-
-internal open external class Emitter {
- constructor(obj: Any)
- constructor()
-
- open fun on(event: String, fn: () -> Unit)
- open fun off(event: String, fn: () -> Unit)
- open fun once(event: String, fn: () -> Unit)
- open fun emit(event: String, vararg any: Any)
- open fun listeners(event: String): Array<() -> Unit>
- open fun hasListeners(event: String): Boolean
-}
diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/estree/estree.extensions.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/estree/estree.extensions.kt
deleted file mode 100644
index 122a3a397..000000000
--- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/estree/estree.extensions.kt
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.internal.estree
-
-internal fun Program(sourceType: String, vararg body: dynamic) = object : Program {
- override var type = "Program"
- override var sourceType = sourceType
- override var body = body
-}
-
-internal fun VariableDeclaration(kind: String, vararg declarations: VariableDeclarator) = object : VariableDeclaration {
- override var type = "VariableDeclaration"
- override var declarations = declarations.toList().toTypedArray()
- override var kind = kind
-}
-
-internal fun VariableDeclarator(id: dynamic, init: dynamic) = object : VariableDeclarator {
- override var type = "VariableDeclarator"
- override var id = id
- override var init = init
-}
-
-internal fun Identifier(name: String) = object : Identifier {
- override var type = "Identifier"
- override var name = name
-}
-
-internal fun FunctionExpression(params: Array, body: BlockStatement) = object : FunctionExpression {
- override var params = params
- override var type = "FunctionExpression"
- override var body = body
-}
-
-internal fun BlockStatement(vararg body: dynamic) = object : BlockStatement {
- override var type = "BlockStatement"
- override var body = body
-}
-
-internal fun ReturnStatement(argument: dynamic) = object : ReturnStatement {
- override var type = "ReturnStatement"
- override var argument = argument
-}
-
-internal fun SimpleLiteral(value: dynamic) = object : SimpleLiteral {
- override var type = "Literal"
- override var value = value
-}
-
-internal fun MemberExpression(computed: Boolean, optional: Boolean, `object`: dynamic, property: dynamic) =
- object : MemberExpression {
- override var type = "MemberExpression"
- override var computed = computed
- override var optional = optional
- override var `object` = `object`
- override var property = property
- }
-
-internal fun SimpleCallExpression(optional: Boolean, callee: dynamic, vararg arguments: dynamic) =
- object : SimpleCallExpression {
- override var type = "CallExpression"
- override var optional = optional
- override var callee = callee
- override var arguments = arguments
- }
diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/estree/estree.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/estree/estree.kt
deleted file mode 100644
index ad079dbd0..000000000
--- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/estree/estree.kt
+++ /dev/null
@@ -1,651 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-@file:Suppress("ClassName")
-
-package space.kscience.kmath.internal.estree
-
-import kotlin.js.RegExp
-
-internal external interface BaseNodeWithoutComments {
- var type: String
- var loc: SourceLocation?
- get() = definedExternally
- set(value) = definedExternally
- var range: dynamic /* JsTuple */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface BaseNode : BaseNodeWithoutComments {
- var leadingComments: Array?
- get() = definedExternally
- set(value) = definedExternally
- var trailingComments: Array?
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface Comment : BaseNodeWithoutComments {
- override var type: String /* "Line" | "Block" */
- var value: String
-}
-
-internal external interface SourceLocation {
- var source: String?
- get() = definedExternally
- set(value) = definedExternally
- var start: Position
- var end: Position
-}
-
-internal external interface Position {
- var line: Number
- var column: Number
-}
-
-internal external interface Program : BaseNode {
- override var type: String /* "Program" */
- var sourceType: String /* "script" | "module" */
- var body: Array
- var comments: Array?
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface Directive : BaseNode {
- override var type: String /* "ExpressionStatement" */
- var expression: dynamic /* SimpleLiteral | RegExpLiteral */
- get() = definedExternally
- set(value) = definedExternally
- var directive: String
-}
-
-internal external interface BaseFunction : BaseNode {
- var params: Array
- var generator: Boolean?
- get() = definedExternally
- set(value) = definedExternally
- var async: Boolean?
- get() = definedExternally
- set(value) = definedExternally
- var body: dynamic /* BlockStatement | ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface BaseStatement : BaseNode
-
-internal external interface EmptyStatement : BaseStatement {
- override var type: String /* "EmptyStatement" */
-}
-
-internal external interface BlockStatement : BaseStatement {
- override var type: String /* "BlockStatement" */
- var body: Array
- var innerComments: Array?
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface ExpressionStatement : BaseStatement {
- override var type: String /* "ExpressionStatement" */
- var expression: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface IfStatement : BaseStatement {
- override var type: String /* "IfStatement" */
- var test: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
- var consequent: dynamic /* ExpressionStatement | BlockStatement | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | FunctionDeclaration | VariableDeclaration | ClassDeclaration */
- get() = definedExternally
- set(value) = definedExternally
- var alternate: dynamic /* ExpressionStatement? | BlockStatement? | EmptyStatement? | DebuggerStatement? | WithStatement? | ReturnStatement? | LabeledStatement? | BreakStatement? | ContinueStatement? | IfStatement? | SwitchStatement? | ThrowStatement? | TryStatement? | WhileStatement? | DoWhileStatement? | ForStatement? | ForInStatement? | ForOfStatement? | FunctionDeclaration? | VariableDeclaration? | ClassDeclaration? */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface LabeledStatement : BaseStatement {
- override var type: String /* "LabeledStatement" */
- var label: Identifier
- var body: dynamic /* ExpressionStatement | BlockStatement | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | FunctionDeclaration | VariableDeclaration | ClassDeclaration */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface BreakStatement : BaseStatement {
- override var type: String /* "BreakStatement" */
- var label: Identifier?
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface ContinueStatement : BaseStatement {
- override var type: String /* "ContinueStatement" */
- var label: Identifier?
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface WithStatement : BaseStatement {
- override var type: String /* "WithStatement" */
- var `object`: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
- var body: dynamic /* ExpressionStatement | BlockStatement | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | FunctionDeclaration | VariableDeclaration | ClassDeclaration */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface SwitchStatement : BaseStatement {
- override var type: String /* "SwitchStatement" */
- var discriminant: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
- var cases: Array
-}
-
-internal external interface ReturnStatement : BaseStatement {
- override var type: String /* "ReturnStatement" */
- var argument: dynamic /* ThisExpression? | ArrayExpression? | ObjectExpression? | FunctionExpression? | ArrowFunctionExpression? | YieldExpression? | SimpleLiteral? | RegExpLiteral? | UnaryExpression? | UpdateExpression? | BinaryExpression? | AssignmentExpression? | LogicalExpression? | MemberExpression? | ConditionalExpression? | SimpleCallExpression? | NewExpression? | SequenceExpression? | TemplateLiteral? | TaggedTemplateExpression? | ClassExpression? | MetaProperty? | Identifier? | AwaitExpression? | ImportExpression? | ChainExpression? */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface ThrowStatement : BaseStatement {
- override var type: String /* "ThrowStatement" */
- var argument: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface TryStatement : BaseStatement {
- override var type: String /* "TryStatement" */
- var block: BlockStatement
- var handler: CatchClause?
- get() = definedExternally
- set(value) = definedExternally
- var finalizer: BlockStatement?
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface WhileStatement : BaseStatement {
- override var type: String /* "WhileStatement" */
- var test: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
- var body: dynamic /* ExpressionStatement | BlockStatement | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | FunctionDeclaration | VariableDeclaration | ClassDeclaration */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface DoWhileStatement : BaseStatement {
- override var type: String /* "DoWhileStatement" */
- var body: dynamic /* ExpressionStatement | BlockStatement | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | FunctionDeclaration | VariableDeclaration | ClassDeclaration */
- get() = definedExternally
- set(value) = definedExternally
- var test: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface ForStatement : BaseStatement {
- override var type: String /* "ForStatement" */
- var init: dynamic /* VariableDeclaration? | ThisExpression? | ArrayExpression? | ObjectExpression? | FunctionExpression? | ArrowFunctionExpression? | YieldExpression? | SimpleLiteral? | RegExpLiteral? | UnaryExpression? | UpdateExpression? | BinaryExpression? | AssignmentExpression? | LogicalExpression? | MemberExpression? | ConditionalExpression? | SimpleCallExpression? | NewExpression? | SequenceExpression? | TemplateLiteral? | TaggedTemplateExpression? | ClassExpression? | MetaProperty? | Identifier? | AwaitExpression? | ImportExpression? | ChainExpression? */
- get() = definedExternally
- set(value) = definedExternally
- var test: dynamic /* ThisExpression? | ArrayExpression? | ObjectExpression? | FunctionExpression? | ArrowFunctionExpression? | YieldExpression? | SimpleLiteral? | RegExpLiteral? | UnaryExpression? | UpdateExpression? | BinaryExpression? | AssignmentExpression? | LogicalExpression? | MemberExpression? | ConditionalExpression? | SimpleCallExpression? | NewExpression? | SequenceExpression? | TemplateLiteral? | TaggedTemplateExpression? | ClassExpression? | MetaProperty? | Identifier? | AwaitExpression? | ImportExpression? | ChainExpression? */
- get() = definedExternally
- set(value) = definedExternally
- var update: dynamic /* ThisExpression? | ArrayExpression? | ObjectExpression? | FunctionExpression? | ArrowFunctionExpression? | YieldExpression? | SimpleLiteral? | RegExpLiteral? | UnaryExpression? | UpdateExpression? | BinaryExpression? | AssignmentExpression? | LogicalExpression? | MemberExpression? | ConditionalExpression? | SimpleCallExpression? | NewExpression? | SequenceExpression? | TemplateLiteral? | TaggedTemplateExpression? | ClassExpression? | MetaProperty? | Identifier? | AwaitExpression? | ImportExpression? | ChainExpression? */
- get() = definedExternally
- set(value) = definedExternally
- var body: dynamic /* ExpressionStatement | BlockStatement | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | FunctionDeclaration | VariableDeclaration | ClassDeclaration */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface BaseForXStatement : BaseStatement {
- var left: dynamic /* VariableDeclaration | Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression */
- get() = definedExternally
- set(value) = definedExternally
- var right: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
- var body: dynamic /* ExpressionStatement | BlockStatement | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | FunctionDeclaration | VariableDeclaration | ClassDeclaration */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface ForInStatement : BaseForXStatement {
- override var type: String /* "ForInStatement" */
-}
-
-internal external interface DebuggerStatement : BaseStatement {
- override var type: String /* "DebuggerStatement" */
-}
-
-internal external interface BaseDeclaration : BaseStatement
-
-internal external interface FunctionDeclaration : BaseFunction, BaseDeclaration {
- override var type: String /* "FunctionDeclaration" */
- var id: Identifier?
- override var body: BlockStatement
-}
-
-internal external interface VariableDeclaration : BaseDeclaration {
- override var type: String /* "VariableDeclaration" */
- var declarations: Array
- var kind: String /* "var" | "let" | "const" */
-}
-
-internal external interface VariableDeclarator : BaseNode {
- override var type: String /* "VariableDeclarator" */
- var id: dynamic /* Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression */
- get() = definedExternally
- set(value) = definedExternally
- var init: dynamic /* ThisExpression? | ArrayExpression? | ObjectExpression? | FunctionExpression? | ArrowFunctionExpression? | YieldExpression? | SimpleLiteral? | RegExpLiteral? | UnaryExpression? | UpdateExpression? | BinaryExpression? | AssignmentExpression? | LogicalExpression? | MemberExpression? | ConditionalExpression? | SimpleCallExpression? | NewExpression? | SequenceExpression? | TemplateLiteral? | TaggedTemplateExpression? | ClassExpression? | MetaProperty? | Identifier? | AwaitExpression? | ImportExpression? | ChainExpression? */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface BaseExpression : BaseNode
-
-internal external interface ChainExpression : BaseExpression {
- override var type: String /* "ChainExpression" */
- var expression: dynamic /* SimpleCallExpression | MemberExpression */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface ThisExpression : BaseExpression {
- override var type: String /* "ThisExpression" */
-}
-
-internal external interface ArrayExpression : BaseExpression {
- override var type: String /* "ArrayExpression" */
- var elements: Array
-}
-
-internal external interface ObjectExpression : BaseExpression {
- override var type: String /* "ObjectExpression" */
- var properties: Array
-}
-
-internal external interface Property : BaseNode {
- override var type: String /* "Property" */
- var key: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
- var value: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern */
- get() = definedExternally
- set(value) = definedExternally
- var kind: String /* "init" | "get" | "set" */
- var method: Boolean
- var shorthand: Boolean
- var computed: Boolean
-}
-
-internal external interface FunctionExpression : BaseFunction, BaseExpression {
- var id: Identifier?
- get() = definedExternally
- set(value) = definedExternally
- override var type: String /* "FunctionExpression" */
- override var body: BlockStatement
-}
-
-internal external interface SequenceExpression : BaseExpression {
- override var type: String /* "SequenceExpression" */
- var expressions: Array
-}
-
-internal external interface UnaryExpression : BaseExpression {
- override var type: String /* "UnaryExpression" */
- var operator: String /* "-" | "+" | "!" | "~" | "typeof" | "void" | "delete" */
- var prefix: Boolean
- var argument: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface BinaryExpression : BaseExpression {
- override var type: String /* "BinaryExpression" */
- var operator: String /* "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "|" | "^" | "&" | "in" | "instanceof" */
- var left: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
- var right: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface AssignmentExpression : BaseExpression {
- override var type: String /* "AssignmentExpression" */
- var operator: String /* "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" */
- var left: dynamic /* Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression */
- get() = definedExternally
- set(value) = definedExternally
- var right: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface UpdateExpression : BaseExpression {
- override var type: String /* "UpdateExpression" */
- var operator: String /* "++" | "--" */
- var argument: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
- var prefix: Boolean
-}
-
-internal external interface LogicalExpression : BaseExpression {
- override var type: String /* "LogicalExpression" */
- var operator: String /* "||" | "&&" | "??" */
- var left: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
- var right: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface ConditionalExpression : BaseExpression {
- override var type: String /* "ConditionalExpression" */
- var test: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
- var alternate: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
- var consequent: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface BaseCallExpression : BaseExpression {
- var callee: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression | Super */
- get() = definedExternally
- set(value) = definedExternally
- var arguments: Array
-}
-
-internal external interface SimpleCallExpression : BaseCallExpression {
- override var type: String /* "CallExpression" */
- var optional: Boolean
-}
-
-internal external interface NewExpression : BaseCallExpression {
- override var type: String /* "NewExpression" */
-}
-
-internal external interface MemberExpression : BaseExpression, BasePattern {
- override var type: String /* "MemberExpression" */
- var `object`: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression | Super */
- get() = definedExternally
- set(value) = definedExternally
- var property: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
- var computed: Boolean
- var optional: Boolean
-}
-
-internal external interface BasePattern : BaseNode
-
-internal external interface SwitchCase : BaseNode {
- override var type: String /* "SwitchCase" */
- var test: dynamic /* ThisExpression? | ArrayExpression? | ObjectExpression? | FunctionExpression? | ArrowFunctionExpression? | YieldExpression? | SimpleLiteral? | RegExpLiteral? | UnaryExpression? | UpdateExpression? | BinaryExpression? | AssignmentExpression? | LogicalExpression? | MemberExpression? | ConditionalExpression? | SimpleCallExpression? | NewExpression? | SequenceExpression? | TemplateLiteral? | TaggedTemplateExpression? | ClassExpression? | MetaProperty? | Identifier? | AwaitExpression? | ImportExpression? | ChainExpression? */
- get() = definedExternally
- set(value) = definedExternally
- var consequent: Array
-}
-
-internal external interface CatchClause : BaseNode {
- override var type: String /* "CatchClause" */
- var param: dynamic /* Identifier? | ObjectPattern? | ArrayPattern? | RestElement? | AssignmentPattern? | MemberExpression? */
- get() = definedExternally
- set(value) = definedExternally
- var body: BlockStatement
-}
-
-internal external interface Identifier : BaseNode, BaseExpression, BasePattern {
- override var type: String /* "Identifier" */
- var name: String
-}
-
-internal external interface SimpleLiteral : BaseNode, BaseExpression {
- override var type: String /* "Literal" */
- var value: dynamic /* String? | Boolean? | Number? */
- get() = definedExternally
- set(value) = definedExternally
- var raw: String?
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface `T$1` {
- var pattern: String
- var flags: String
-}
-
-internal external interface RegExpLiteral : BaseNode, BaseExpression {
- override var type: String /* "Literal" */
- var value: RegExp?
- get() = definedExternally
- set(value) = definedExternally
- var regex: `T$1`
- var raw: String?
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface ForOfStatement : BaseForXStatement {
- override var type: String /* "ForOfStatement" */
- var await: Boolean
-}
-
-internal external interface Super : BaseNode {
- override var type: String /* "Super" */
-}
-
-internal external interface SpreadElement : BaseNode {
- override var type: String /* "SpreadElement" */
- var argument: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface ArrowFunctionExpression : BaseExpression, BaseFunction {
- override var type: String /* "ArrowFunctionExpression" */
- var expression: Boolean
- override var body: dynamic /* BlockStatement | ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface YieldExpression : BaseExpression {
- override var type: String /* "YieldExpression" */
- var argument: dynamic /* ThisExpression? | ArrayExpression? | ObjectExpression? | FunctionExpression? | ArrowFunctionExpression? | YieldExpression? | SimpleLiteral? | RegExpLiteral? | UnaryExpression? | UpdateExpression? | BinaryExpression? | AssignmentExpression? | LogicalExpression? | MemberExpression? | ConditionalExpression? | SimpleCallExpression? | NewExpression? | SequenceExpression? | TemplateLiteral? | TaggedTemplateExpression? | ClassExpression? | MetaProperty? | Identifier? | AwaitExpression? | ImportExpression? | ChainExpression? */
- get() = definedExternally
- set(value) = definedExternally
- var delegate: Boolean
-}
-
-internal external interface TemplateLiteral : BaseExpression {
- override var type: String /* "TemplateLiteral" */
- var quasis: Array
- var expressions: Array
-}
-
-internal external interface TaggedTemplateExpression : BaseExpression {
- override var type: String /* "TaggedTemplateExpression" */
- var tag: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
- var quasi: TemplateLiteral
-}
-
-internal external interface `T$2` {
- var cooked: String
- var raw: String
-}
-
-internal external interface TemplateElement : BaseNode {
- override var type: String /* "TemplateElement" */
- var tail: Boolean
- var value: `T$2`
-}
-
-internal external interface AssignmentProperty : Property {
- override var value: dynamic /* Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression */
- get() = definedExternally
- set(value) = definedExternally
- override var kind: String /* "init" */
- override var method: Boolean
-}
-
-internal external interface ObjectPattern : BasePattern {
- override var type: String /* "ObjectPattern" */
- var properties: Array
-}
-
-internal external interface ArrayPattern : BasePattern {
- override var type: String /* "ArrayPattern" */
- var elements: Array
-}
-
-internal external interface RestElement : BasePattern {
- override var type: String /* "RestElement" */
- var argument: dynamic /* Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface AssignmentPattern : BasePattern {
- override var type: String /* "AssignmentPattern" */
- var left: dynamic /* Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression */
- get() = definedExternally
- set(value) = definedExternally
- var right: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface BaseClass : BaseNode {
- var superClass: dynamic /* ThisExpression? | ArrayExpression? | ObjectExpression? | FunctionExpression? | ArrowFunctionExpression? | YieldExpression? | SimpleLiteral? | RegExpLiteral? | UnaryExpression? | UpdateExpression? | BinaryExpression? | AssignmentExpression? | LogicalExpression? | MemberExpression? | ConditionalExpression? | SimpleCallExpression? | NewExpression? | SequenceExpression? | TemplateLiteral? | TaggedTemplateExpression? | ClassExpression? | MetaProperty? | Identifier? | AwaitExpression? | ImportExpression? | ChainExpression? */
- get() = definedExternally
- set(value) = definedExternally
- var body: ClassBody
-}
-
-internal external interface ClassBody : BaseNode {
- override var type: String /* "ClassBody" */
- var body: Array
-}
-
-internal external interface MethodDefinition : BaseNode {
- override var type: String /* "MethodDefinition" */
- var key: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
- var value: FunctionExpression
- var kind: String /* "constructor" | "method" | "get" | "set" */
- var computed: Boolean
- var static: Boolean
-}
-
-internal external interface ClassDeclaration : BaseClass, BaseDeclaration {
- override var type: String /* "ClassDeclaration" */
- var id: Identifier?
-}
-
-internal external interface ClassExpression : BaseClass, BaseExpression {
- override var type: String /* "ClassExpression" */
- var id: Identifier?
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface MetaProperty : BaseExpression {
- override var type: String /* "MetaProperty" */
- var meta: Identifier
- var property: Identifier
-}
-
-internal external interface BaseModuleDeclaration : BaseNode
-
-internal external interface BaseModuleSpecifier : BaseNode {
- var local: Identifier
-}
-
-internal external interface ImportDeclaration : BaseModuleDeclaration {
- override var type: String /* "ImportDeclaration" */
- var specifiers: Array
- var source: dynamic /* SimpleLiteral | RegExpLiteral */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface ImportSpecifier : BaseModuleSpecifier {
- override var type: String /* "ImportSpecifier" */
- var imported: Identifier
-}
-
-internal external interface ImportExpression : BaseExpression {
- override var type: String /* "ImportExpression" */
- var source: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface ImportDefaultSpecifier : BaseModuleSpecifier {
- override var type: String /* "ImportDefaultSpecifier" */
-}
-
-internal external interface ImportNamespaceSpecifier : BaseModuleSpecifier {
- override var type: String /* "ImportNamespaceSpecifier" */
-}
-
-internal external interface ExportNamedDeclaration : BaseModuleDeclaration {
- override var type: String /* "ExportNamedDeclaration" */
- var declaration: dynamic /* FunctionDeclaration? | VariableDeclaration? | ClassDeclaration? */
- get() = definedExternally
- set(value) = definedExternally
- var specifiers: Array
- var source: dynamic /* SimpleLiteral? | RegExpLiteral? */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface ExportSpecifier : BaseModuleSpecifier {
- override var type: String /* "ExportSpecifier" */
- var exported: Identifier
-}
-
-internal external interface ExportDefaultDeclaration : BaseModuleDeclaration {
- override var type: String /* "ExportDefaultDeclaration" */
- var declaration: dynamic /* FunctionDeclaration | VariableDeclaration | ClassDeclaration | ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface ExportAllDeclaration : BaseModuleDeclaration {
- override var type: String /* "ExportAllDeclaration" */
- var source: dynamic /* SimpleLiteral | RegExpLiteral */
- get() = definedExternally
- set(value) = definedExternally
-}
-
-internal external interface AwaitExpression : BaseExpression {
- override var type: String /* "AwaitExpression" */
- var argument: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */
- get() = definedExternally
- set(value) = definedExternally
-}
diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/stream/stream.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/stream/stream.kt
deleted file mode 100644
index caab91731..000000000
--- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/stream/stream.kt
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.internal.stream
-
-import space.kscience.kmath.internal.emitter.Emitter
-
-internal open external class Stream : Emitter {
- open fun pipe(dest: Any, options: Any): Any
-}
diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/tsstdlib/lib.es2015.iterable.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/tsstdlib/lib.es2015.iterable.kt
deleted file mode 100644
index 5c091e3a1..000000000
--- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/tsstdlib/lib.es2015.iterable.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2018-2021 KMath contributors.
- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
- */
-
-package space.kscience.kmath.internal.tsstdlib
-
-internal external interface IteratorYieldResult {
- var done: Boolean?
- get() = definedExternally
- set(value) = definedExternally
- var value: TYield
-}
-
-internal external interface IteratorReturnResult