integrated operator recognition routine

This commit is contained in:
FeralChild64 committed 2020-06-07 15:01:09 +02:00
1 parent 1b26151a3f
commit 831bc8f453
3 files changed
+131 -44

No files matched your search

+19 -25
View File
@@ -9,38 +9,32 @@
.const operator_list = List().add(
// Tokens XXX
// Tokens $AA-$B0
oper_add,
oper_sub,
oper_mul,
oper_div,
oper_add, // ID: $01
oper_sub, // ID: $02
oper_mul, // ID: $03
oper_div, // ID: $04
oper_pow, // ID: $05
oper_and, // ID: $06
oper_or, // ID: $07
// Tokens XXX
// Tokens $B1-$B3
oper_and,
oper_or,
// Tokens XXX
oper_cmp_gt,
oper_cmp_eq,
oper_cmp_lt,
oper_cmp_gt, // ID: $08
oper_cmp_eq, // ID: $09
oper_cmp_lt, // ID: $0A
// Combined two tokens
oper_cmp_gteq,
oper_cmp_lteq,
oper_cmp_neq,
oper_cmp_gteq, // ID: $0B
oper_cmp_lteq, // ID: $0C
oper_cmp_neq, // ID: $0D
// Not a token
// Unary operators
oper_pow,
// Unary
oper_unary_minus,
oper_unary_not
oper_unary_minus, // ID: $0E
oper_unary_not // ID: $0F
)
@@ -50,6 +44,7 @@ operator_priorities: // higher number = higher priority
.byte $05 // oper_sub
.byte $06 // oper_mul
.byte $06 // oper_div
.byte $08 // oper_pow
.byte $02 // oper_and
.byte $01 // oper_or
.byte $04 // oper_cmp_gt
@@ -58,7 +53,6 @@ operator_priorities: // higher number = higher priority
.byte $04 // oper_cmp_gteq
.byte $04 // oper_cmp_lteq
.byte $04 // oper_cmp_neq
.byte $08 // oper_pow
.byte $07 // oper_unary_minus
.byte $03 // oper_unary_not