This works for the basics of RISC-V assembly, but fails for a lot of assembly code that GCC accepts. It should be fine for most human written code, but machine generated code is also common.
Most notably, labels starting with a period are not accepted, but gcc generated assembly has tons of labels like that.
> Unfortunately, the documentation on legal syntax is absolutely terrible.
I totally agree. Determining the semantics of wierd assembly is even harder. At least for syntax you can just see confirm if gnu-as accepts it.
> Did I miss anything else?
I haven't looked into what is actually parsing at all, but it correctly accepts things like %hi, strings delimited by quotes, @function, labels that are just numbers. I had expected some of those to be rejects based on the post.
I don't know what else might fail because I can't try any auto generated code because of the period label issue. I would recommend trying the assembly generated by compiling this project; it shows a bunch of weird pieces of syntax.
Most notably, labels starting with a period are not accepted, but gcc generated assembly has tons of labels like that.