language: add binary operators

- unary binary not
- infix bitwise and
- infix bitwise or
- infix bitwise exclusive or (xor)
This commit is contained in:
2023-09-11 19:21:09 +10:00
parent 24d2ff5743
commit cdcbdb2bdf
6 changed files with 67 additions and 12 deletions

View File

@ -96,6 +96,15 @@ types:
- name: LesserEqual
values:
token: "<="
- name: BinaryAnd
values:
token: "&"
- name: BinaryOr
values:
token: "|"
- name: BinaryExclusiveOr
values:
token: "^"
InfixOperation:
parent: Expression
values:
@ -196,6 +205,9 @@ types:
- name: UnaryMinus
values:
token: "-"
- name: BinaryNot
values:
token: "~"
PrefixOperation:
parent: Expression
values:

View File

@ -18,5 +18,8 @@ enum class InfixOperator(val token: String) {
Lesser("<"),
Greater(">"),
GreaterEqual(">="),
LesserEqual("<=")
LesserEqual("<="),
BinaryAnd("&"),
BinaryOr("|"),
BinaryExclusiveOr("^")
}

View File

@ -9,5 +9,6 @@ import kotlinx.serialization.Serializable
enum class PrefixOperator(val token: String) {
Negate("!"),
UnaryPlus("+"),
UnaryMinus("-")
UnaryMinus("-"),
BinaryNot("~")
}