News for hackers. Stuff that matters.
Re:Parsing RISC-V assembly by e19293001 on Monday October 26, 2020 @10:11PM (#24903881)
Yes. If basic assembler.

No. If you're going to implement an assembler that supports constants and symbols which can be combined into expressions. And expressions can easily be parsed for example[0]:

    〈primary expression〉->〈constant〉|〈symbol〉|〈local operand〉|@|
                        (〈expression〉)|〈unary operator〉〈primary expression〉
    〈term〉->〈primary expression〉|〈term〉〈strong operator〉〈primary expression〉
    〈expression〉->〈term〉|〈expression〉〈weak operator〉〈term〉
    〈unary operator〉-> + | − | ~ | $ | &
    〈strong operator〉-> * | / | // | % | << | >> | &
    〈weak operator〉-> + | − | | | ^
Your code might be hard to read if you'll not create a parse tree for it.

[0] - http://www.mmix.cs.hm.edu/doc/mmixal.pdf

There are no comments on this comment yet.