adafruit / Adafruit_CircuitPython_PIOASM

Simple assembler to convert pioasm to bytes
MIT License
27 stars 17 forks source link

Rewrite parser #43

Closed jepler closed 2 years ago

jepler commented 2 years ago

Re-implement pioasm

This passes all tests, with many error messages improved. Most errors now show their context, such as

adafruit_pioasm.ParseError: Line 1, column 5: Jump to undefined label undef
    jmp undef
        ^
adafruit_pioasm.ParseError: Line 1, column 5: Expected 'pins', 'x', 'y', None, 'exec', 'pc', 'isr', 'osr'
    mov hello
        ^

This should set the stage for adding expression parsing and supporting ".define".

Closes #40

jepler commented 2 years ago

This incarnation sort of mashes together tokenization & recursive-descent parsing without lookahead. Implementing operator precedence becomes a bit puzzling in this design, so maybe another design needs to be tried.

jepler commented 2 years ago

I don't have plans to work on this at the moment, so closing it up.