language: add binary operators (#6)

- unary binary not
- infix bitwise and
- infix bitwise or
- infix bitwise exclusive or (xor)
This commit is contained in:
a dinosaur
2023-09-11 19:24:08 +10:00
committed by GitHub
parent d8c0ef43c1
commit 9ba150bb69
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("~")
}