riff-lang / riff

The Riff programming language
https://riff.cx
BSD Zero Clause License
23 stars 1 forks source link

Postfix increment/decrement not being bound to member access expressions #47

Closed darrylabbate closed 1 year ago

darrylabbate commented 1 year ago

Likely an issue with some parser flag being set.

$ riff -e 'x.y++'
riff: [compile] line 1: expected symbol following prefix ++/--

Functionally equivalent expression:

$ riff -le 'x["y"]++'
source:<command-line> @ 0x16d22b3a0 -> 6 bytes
0:  47        GBLA    0       // x
1:  44        CONST   1       // "y"
2:  60        IDXA
3:  2c        POSTINC
4:  3a        POP
5:  59        RET

Prefix version works fine:

$ riff -le '++x.y'
source:<command-line> @ 0x16b9533a0 -> 6 bytes
0:  47        GBLA    0       // x
1:  62 01     SIDXA   1       // y
3:  2a        PREINC
4:  3a        POP
5:  59        RET