There is a program that translates the expression into the reverse Polish notation and then calculates the result. I need at the time of evaluation to translate the expression into the assembler code in the output.txt file. For example:
5 - 10 + 20 * 5 - 30 + 3 assign R0, 20
assign R4, 5
mul R0, R4, R0
assign R4, 5
assign R8, 10
sub R4, R8, R4
add R4, R0, R0
assign R4, 30
sub R0, R4, R0
assing r4,3
add R0, R4, R0
How to implement such a task so that the program correctly distributes the expression to the registers and then writes it down?