From b2a771602fc5b6eaba10cdfabbd4f05725d41bdc Mon Sep 17 00:00:00 2001 From: Jan-Niclas Loosen Date: Tue, 16 Dec 2025 10:26:52 +0100 Subject: [PATCH] Testing complex tram --- Project-02-03/tramcodes/complex.tram | 65 ++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Project-02-03/tramcodes/complex.tram diff --git a/Project-02-03/tramcodes/complex.tram b/Project-02-03/tramcodes/complex.tram new file mode 100644 index 0000000..a4372bf --- /dev/null +++ b/Project-02-03/tramcodes/complex.tram @@ -0,0 +1,65 @@ + GOTO L1 +L2: NOP + LOAD 0 0 + CONST 0 + EQ + IFZERO L4 + CONST 0 + GOTO L5 +L4: NOP + LOAD 0 0 + CONST 1 + SUB + INVOKE 1 L2 1 +L5: NOP + RETURN +L3: NOP + LOAD 0 0 + LOAD 1 0 + GT + IFZERO L6 + LOAD 0 0 + INVOKE 1 L2 1 + GOTO L7 +L6: NOP + LOAD 1 0 + INVOKE 1 L2 1 + POP + GOTO L8 +L9: NOP + LOAD 0 1 + LOAD 1 1 + MUL + LOAD 0 0 + MUL + RETURN +L8: NOP + LOAD 0 0 + LOAD 1 0 + MUL + INVOKE 1 L9 0 +L7: NOP + RETURN +L1: NOP + CONST 10 + INVOKE 1 L2 0 + POP + CONST 10 + GOTO L10 +L11: NOP + LOAD 0 0 + LOAD 1 0 + GT + IFZERO L12 + LOAD 0 0 + GOTO L13 +L12: NOP + LOAD 1 0 +L13: NOP + RETURN +L10: NOP + CONST 20 + CONST 30 + INVOKE 2 L11 0 + INVOKE 2 L3 0 + HALT