summaryrefslogtreecommitdiff
path: root/ecomp-c/test1.e
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2020-03-01 19:34:07 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2020-03-01 19:34:07 +0100
commitad3e2207cb53ee2ce0d3e00f6646a1bf7b30d002 (patch)
tree45c6e3544faad38f3b89d90bf4817f64f07d6f35 /ecomp-c/test1.e
parent1502b0f01cf6cc1d52eba9167f43eca10fdc0b00 (diff)
downloadcompilertests-ad3e2207cb53ee2ce0d3e00f6646a1bf7b30d002.tar.gz
compilertests-ad3e2207cb53ee2ce0d3e00f6646a1bf7b30d002.tar.bz2
simplistic code generation works for expressions
Diffstat (limited to 'ecomp-c/test1.e')
-rw-r--r--ecomp-c/test1.e12
1 files changed, 6 insertions, 6 deletions
diff --git a/ecomp-c/test1.e b/ecomp-c/test1.e
index 454794a..688297f 100644
--- a/ecomp-c/test1.e
+++ b/ecomp-c/test1.e
@@ -20,10 +20,10 @@ var
begin
a := 1;
b := 7;
- c := N;
- a := b;
- a := a + 1;
- d := a * c + b;
- d := a * ( c + b );
- e := ( ( 7 * a + b ) + 2 * ( b + a + 3 ) ) * 2;
+ c := N; // c should be 20
+ a := b; // a should be 7
+ a := a + 1; // a should be 8 now
+ d := a * c + b; // d should be 8 * 20 + 7 = 167 (A7 hex)
+ d := a * ( c + b ); // d should be 8 * ( 20 + 7 ) = 216 (D8 hex)
+ e := ( ( 7 * a + b ) + 2 * ( b + a + 3 ) ) * 2; // ((7*8+7)+2*(7+8+3))*2=198 (C6 hex)
end