CSE Project: Write interpreter in Python
casesV3/Correct/01.code
program int X , Y , XY ; begin input X ; Y := 0 ; input XY, Y ; output XY ; Y := Y + XY ; X := X - 1 ; while 0 < X begin input XY ; output XY ; Y := Y + XY ; X := X - 1 ; endwhile ; output Y ; end
casesV3/Correct/01.data
5 10 7 -4 10 5 -9
casesV3/Correct/01.expected
program int X,Y,XY; begin input X; Y:=0; input XY,Y; output XY; Y:=Y+XY; X:=X-1; while 0<X begin input XY; output XY; Y:=Y+XY; X:=X-1; endwhile; output Y; end 10 -4 10 5 -9 19
casesV3/Correct/02.code
program int X , Y , XY ; begin X := 0; output X; end
casesV3/Correct/02.data
5 10 7 -4 10 5 -9
casesV3/Correct/02.expected
program int X,Y,XY; begin X:=0; output X; end 0
casesV3/Correct/03.code
program int X , Y, Z; begin input X, Y, Z; while !(X = 0) begin output Y; while Y < 10 begin Y := Y + 1; endwhile; output Y; Y := Z; X := X - 1; endwhile; end
casesV3/Correct/03.data
3 2 10
casesV3/Correct/03.expected
program int X,Y,Z; begin input X,Y,Z; while !(X=0) begin output Y; while Y<10 begin Y:=Y+1; endwhile; output Y; Y:=Z; X:=X-1; endwhile; end 2 10 10 10 10 10
casesV3/Correct/04.code
program int X , Y , XY ; A(r) begin r:=0; endfunc; begin input X, Y, XY; if !(X = Y) then if X < Y then output 1; else output 2; endif; endif; begin A(XY); output XY; end
casesV3/Correct/04.data
1 2 3 2 1 3 1 1 3 10 10 10
casesV3/Correct/04.expected
program int X,Y,XY; A(r) begin r:=0; endfunc; begin input X,Y,XY; if !(X=Y) then if X<Y then output 1; else output 2; endif; endif; begin A(XY); output XY; end 1 0
casesV3/Correct/05.code
program int X , Y , XY ; begin input X, Y; while !(X = 0) begin Y := Y * Y; X := X - 1; endwhile; output Y; end
casesV3/Correct/05.data
3 2 100
casesV3/Correct/05.expected
program int X,Y,XY; begin input X,Y; while !(X=0) begin Y:=Y*Y; X:=X-1; endwhile; output Y; end 256
casesV3/Error/01.code
program int X , Y , XY ; begin input X ; Y := 0 ; input XY, Y ; output XY ; Y := Y + XY ; X := X - 1 ; while 0 < X begin input XY ; output XY ; Y := Y + XYX := X - 1 ; endwhile ; output Y ; end
casesV3/Error/01.data
5 10 7 -4 10 5 -9
casesV3/Error/01.expected
XYX not declared
casesV3/Error/02.code
program int X , Y , XY ; X := 0; output X; end what is this doing here
casesV3/Error/02.data
5 10 7 -4 10 5 -9
casesV3/Error/02.expected
non-whitespace characters after END
casesV3/Error/03.code
program int X , Y, Z; input X, Y, Z; while !(X = 0) begin output Y; while Y < 10 begin Y := Y + 1; endwhile; output Y; Y := Z X := X - 1; endwhile;
casesV3/Error/03.data
3 2 10
casesV3/Error/03.expected
Missing END
casesV3/Error/04.code
program int X , Y , XY ; input X, Y, XYZ; if !(X = Y) then if X < Y then output 1; else output 2; endif; output 3; endif; input X, Y, XY; if !(X = Y) then if X < Y then output 10; else output 20; endif; output 30; endif; input X, Y, XY; if !(X = Y) then if X < Y then output 100; else output 200; endif; output 300; endif; input X, Y, XY; if X = Y then output 1000; else if !(X <= Y) then output 2000; else output 3000; endif; endif; end
casesV3/Error/04.data
1 2 3 2 1 3 1 1 3 10 10 10
casesV3/Error/04.expected
XYZ undeclared
casesV3/Error/05.code
program int X , Y , XY ; input X, Y; while !(X ==== 0) begin Y := Y * Y; X := X - 1; endwhile; output Y; end
casesV3/Error/05.data
3 2 100
casesV3/Error/05.expected
!(X ==== 0) not valid