zilch-lang/nstar

Represent `Integer` tokens as `Text` instead of `Integer`

Closed this issue · 1 comments

Everything is explained here: https://github.com/nihil-lang/nsc/blob/087922f9aafd2c0fd3f0416d14d4247edc3038dd/lib/nsc-parser/src/Language/NStar/Syntax/Lexer.hs#L140-L152

This breaks the parser sometimes, producing error messages like

[error]: Parse error on input
     In: test/error_unknownRegister.nst

 1| mov %0123, %rax
         ^ unrecognized register '123'

Registers are fixed depending on the target architecture.
Registers available in different architectures are documented here:
<https://github.com/nihil-lang/nsc/blob/develop/docs/registers.md>.

The error message should instead report the unrecognized register being 0123.
While this isn't much of an issue, it is better to have consistency in early stages.

Issue has been fixed in 7007a27.
The test test/error_movToInteger.nst now reports

 [error]: Parse error on input
      In: test/error_movToInteger.nst

  9| mov %0123, %rax
          ^ unrecognized register '0123'

 Registers are fixed depending on the target architecture.
 Registers available in different architectures are documented here:
 <https://github.com/nihil-lang/nsc/blob/develop/docs/registers.md>.

which is the expected error. 🎉