added list of operators and priorities
This commit is contained in:
1 parent
855d8c43d5
commit
d7a8649432
18 files changed
+232
-11
No files matched your search
@@ -3,7 +3,7 @@
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
oper_plus:
|
||||
oper_add:
|
||||
|
||||
// This operator can be used either with two strings, or with two floats
|
||||
// First check whether arguments match and then choose the variant
|
||||
@@ -13,17 +13,17 @@ oper_plus:
|
||||
bne_16 do_TYPE_MISMATCH_error
|
||||
|
||||
lda VALTYP
|
||||
bmi oper_plus_strings
|
||||
bmi oper_add_strings
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
oper_plus_floats:
|
||||
oper_add_floats:
|
||||
|
||||
// XXX implement this
|
||||
|
||||
jmp do_NOT_IMPLEMENTED_error
|
||||
|
||||
oper_plus_strings:
|
||||
oper_add_strings:
|
||||
|
||||
// Pull string length
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
oper_and:
|
||||
|
||||
// XXX provide implementation
|
||||
|
||||
jmp do_NOT_IMPLEMENTED_error
|
||||
@@ -0,0 +1,10 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
oper_cmp_eq:
|
||||
|
||||
// XXX provide implementation
|
||||
|
||||
jmp do_NOT_IMPLEMENTED_error
|
||||
@@ -0,0 +1,10 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
oper_cmp_gt:
|
||||
|
||||
// XXX provide implementation
|
||||
|
||||
jmp do_NOT_IMPLEMENTED_error
|
||||
@@ -0,0 +1,10 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
oper_cmp_gteq:
|
||||
|
||||
// XXX provide implementation
|
||||
|
||||
jmp do_NOT_IMPLEMENTED_error
|
||||
@@ -0,0 +1,10 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
oper_cmp_lt:
|
||||
|
||||
// XXX provide implementation
|
||||
|
||||
jmp do_NOT_IMPLEMENTED_error
|
||||
@@ -0,0 +1,10 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
oper_cmp_lteq:
|
||||
|
||||
// XXX provide implementation
|
||||
|
||||
jmp do_NOT_IMPLEMENTED_error
|
||||
@@ -0,0 +1,10 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
oper_cmp_neq:
|
||||
|
||||
// XXX provide implementation
|
||||
|
||||
jmp do_NOT_IMPLEMENTED_error
|
||||
@@ -0,0 +1,10 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
oper_div:
|
||||
|
||||
// XXX provide implementation
|
||||
|
||||
jmp do_NOT_IMPLEMENTED_error
|
||||
@@ -0,0 +1,10 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
oper_mul:
|
||||
|
||||
// XXX provide implementation
|
||||
|
||||
jmp do_NOT_IMPLEMENTED_error
|
||||
@@ -0,0 +1,10 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
oper_or:
|
||||
|
||||
// XXX provide implementation
|
||||
|
||||
jmp do_NOT_IMPLEMENTED_error
|
||||
@@ -0,0 +1,10 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
oper_pow:
|
||||
|
||||
// XXX provide implementation
|
||||
|
||||
jmp do_NOT_IMPLEMENTED_error
|
||||
@@ -0,0 +1,10 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
oper_sub:
|
||||
|
||||
// XXX provide implementation
|
||||
|
||||
jmp do_NOT_IMPLEMENTED_error
|
||||
@@ -0,0 +1,10 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
oper_unary_minus:
|
||||
|
||||
// XXX provide implementation
|
||||
|
||||
jmp do_NOT_IMPLEMENTED_error
|
||||
@@ -0,0 +1,10 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
oper_unary_not:
|
||||
|
||||
// XXX provide implementation
|
||||
|
||||
jmp do_NOT_IMPLEMENTED_error
|
||||
@@ -0,0 +1,74 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Jumptable and priority list for all BASIC operators
|
||||
//
|
||||
|
||||
|
||||
.const operator_list = List().add(
|
||||
|
||||
// Tokens XXX
|
||||
|
||||
oper_add,
|
||||
oper_sub,
|
||||
oper_mul,
|
||||
oper_div,
|
||||
|
||||
// Tokens XXX
|
||||
|
||||
oper_and,
|
||||
oper_or,
|
||||
|
||||
// Tokens XXX
|
||||
|
||||
oper_cmp_gt,
|
||||
oper_cmp_eq,
|
||||
oper_cmp_lt,
|
||||
|
||||
// Combined two tokens
|
||||
|
||||
oper_cmp_gteq,
|
||||
oper_cmp_lteq,
|
||||
oper_cmp_neq,
|
||||
|
||||
// Not a token
|
||||
|
||||
oper_pow,
|
||||
|
||||
// Unary
|
||||
|
||||
oper_unary_minus,
|
||||
oper_unary_not
|
||||
)
|
||||
|
||||
|
||||
operator_priorities: // higher number = higher priority
|
||||
|
||||
.byte $05 // oper_add
|
||||
.byte $05 // oper_sub
|
||||
.byte $06 // oper_mul
|
||||
.byte $06 // oper_div
|
||||
.byte $02 // oper_and
|
||||
.byte $01 // oper_or
|
||||
.byte $04 // oper_cmp_gt
|
||||
.byte $04 // oper_cmp_eq
|
||||
.byte $04 // oper_cmp_lt
|
||||
.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
|
||||
|
||||
|
||||
|
||||
operator_jumptable_lo:
|
||||
|
||||
put_jumptable_lo(operator_list)
|
||||
|
||||
|
||||
operator_jumptable_hi:
|
||||
|
||||
put_jumptable_hi(operator_list)
|
||||
Reference in new issue
Block a user