Skip to content

Commit

Permalink
build: init expression expr #22
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Nov 9, 2022
1 parent eb36785 commit 6562aa6
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions chapi-domain/src/main/kotlin/chapi/domain/expr/Expression.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package chapi.domain.expr

import java.util.function.BinaryOperator
import java.util.function.IntBinaryOperator

class Expression(
var Type: ExpressionType,
var Value: String = "",
var Children: Array<Expression> = arrayOf()
)

enum class ExpressionType {
Primary,
Infix,
Prefix,
Postfix,
}

enum class Arithmetics : BinaryOperator<Int>, IntBinaryOperator {
PLUS {
override fun apply(t: Int, u: Int): Int {
return t + u
}
}
;

override fun applyAsInt(t: Int, u: Int) = apply(t, u)
}

0 comments on commit 6562aa6

Please # to comment.