sasq64 / bass

Advanced 6502 assembler
23 stars 4 forks source link

[request] symbol attributes #27

Closed antis81 closed 3 years ago

antis81 commented 3 years ago

In some cases it can be helpful to define macro parameters read-only (const) and error out when trying a write operation. Here's a draft of what it could look like:

!macro m(foo:const, bar) {
  inc bar  ; ok: bar is not marked read-only

  ; a write "foo" would error out
  inc bar  ; error: bar is readonly
}

Also "assignments" could benefit from that:

value:const = 42

; same for local variables
label_0:
.value:const = 42
sasq64 commented 3 years ago

I think what you really want is for labels to always be constant across one pass. So you should not be allowed to reassign labels. I think this is safer and has no big downside...

antis81 commented 3 years ago

Mmh… yeah, even more this is checked with the "final" flag now (some corner cases remain).