3 ms·
If you asked me to write a JSON parser in 6502 assembly, I would put the fairly short and unambiguous JSON grammar into lex and yacc to get a parser in C, then
by bollorior 6y ago
If you asked me to write a JSON parser in 6502 assembly, I would put the fairly short and unambiguous JSON grammar into lex and yacc to get a parser in C, then compile that to 6502 assembly. Then maybe glance through the assembly code, although I doubt very much that I know anything about assembly that the compiler doesn't.
Of course the author is a highly skilled person who also did this for his enjoyment. But am I missing some way in which what he did would be more than incrementally better than what I would do? Aren't these tools pretty much as good as the best humans at solving this problem?
- m463 6y agoThere are some assembly languages that are pretty straightforward to write code in, and if you're organized it is not too onerous a task. That said, 6502 is probably one of the LEAST featureful assembly languages I've ever used. I remember finding out it didn't have an ADD instruction - you clear carry, then add with carry.
- tyingq 6y agoProcessors like the 6502 aren't considered very C friendly for a variety of reasons, but mostly because the register size isn't big enough for the most common data types like int or char *. You often end up with terrible ASM.
- bollorior 6y agoInteresting, thank you.