sasq64 / bass

Advanced 6502 assembler
23 stars 4 forks source link

Incrementing symbol does not work #37

Open sasq64 opened 1 year ago

sasq64 commented 1 year ago
x = 1
x = x + 1

Fails after max passes. Should work.

sasq64 commented 1 year ago

On second thought -- it probably should not be supported...

antis81 commented 1 year ago

FYI: Trying to access a label that is later defined and then trying to redefine results in fail after max passes.

    jsr plot
    rts

plot:
    nop
    rts

plot:   ; -> fails; expected "error: already defined label 'plot'"
    rts

Note: Addressing this in PR #39

antis81 commented 1 year ago

In the PR I have added both tests. Now it becomes pretty clear that the undefined.insert() line in SymbolTyble::set() is the actual issue. Maybe we can make use of std::any::has_value()…?

antis81 commented 1 year ago

Following ACME as a de-facto standard changing the description slightly will make this goal achievable:

X = 1
!set X = X +1

(obviously ACME also defines symbols constant by default)

Now the bug turns into a feature (request)… :slightly_smiling_face: