1995 - I2P(II)2020_Lee_Mini_Project1_Demo Scoreboard

Time

2020/04/18 10:00:00 2020/04/20 00:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12688 I2P(II)2020_Lee_Mini_Project1

12688 - I2P(II)2020_Lee_Mini_Project1   

Description

You need to implement a calculator.The input is a list of expressions consisting of integers, operators(+,-,*,/,=,&,|,^), and at least three variables x, y, z(x, y, z are exist in the begin, and some local variables will appear in the input file); and the output is a list of assembly codes.

You should merge all your header files and codes into a single file to submit.

Input

Contains mutiple expressions. Each expression is separated by a newline character ('\n').

The initial value of variables, x, y, and z, are stored in memory [0], [4], and [8] respectively. 

If a variable first appear in the left hand side, it is valid and can be use in the right hand side in the future; if a variable first appear in the right hand side, it is invalid and the output should print EXIT 1

After the evaluation of the assembly code, the answer of the variables x, y, z needs to be stored in the registers r0, r1, and r2 respectively.

Output

If the expression is illegal, your final output should be "EXIT 1".

Namely , you don't need to write following codes if the expression is illegal 
          printf("MOV r0 [0]\n"); 
          printf("MOV r1 [4]\n"); 
          printf("MOV r2 [8]\n"); 

Note: You need to output a list of assembly codes. This time the judge is using special judge, and your answer doesn't need to be as same as the sample output. You just need to ensure the final values which are stored in registers r0, r1, and r2 (the value of variables x, y ,and z) is correct.

There must be a “\n” at the end of line.

Sample Input  Download

Sample Output  Download

Tags




Discuss