Open Kyuvi opened 4 years ago
The thing is, this feature is by design - the fact that it interprets s-expressions there as possible function calls is so that you could apply transformations to the assembly code with Racket itself, as a (mostly) hygienic macro system. One of the ways to mitigate this would be to catch the same opcodes in the generic undefined parameters case to emit an error - and this wouldn't need so much rework with the match lambda - but at the same time it would also remove some of the possible specializations a user can make of this library (like user-specific opcode expanders).
A rework of this feature would also not come easy - we're not "parsing" the s-expressions per se, we're using racket's evaluator for that, and at the point that we get the s-expressions all of the file/line info is gone/optimized away.
I have been testing it a bit, and one serious issue for long pieces of code is the lack of error reporting for mistakes in syntax.
Rather than show an error at the point of the mistake, it just says the the instruction (which it then sees as a function) has not been defined.
I.e if the code contains
(adiw oops 50)
, it does not print an error referencing the line, but justFor longer pieces of code with many calls to different instructions, this would cause serious problems. The only solution I can see is refactoring the
match lambda
code, but that will take some time.