Compiler for a Java-like language. Made for the Compiler Construction course, at the Faculty of Sciences, Novi Sad.
Example of micro java:
programPfinalintsize = 10;
classTable {
int[] pos;
int[] neg;
}
Tableval;
{
voidmain()
intx, i;
{ //---------- Initialize valval = newTable;
val.pos = newint[size]; val.neg = newint[size];
i = 0;
while (i < size) {
val.pos[i] = 0; val.neg[i] = 0;
i++;
}
//---------- Read valuesread(x);
while (x != 0) {
if (0 <= x && x < size) {
val.pos[x]++;
} elseif (-size < x && x < 0) {
val.neg[-x]++;
}
read(x);
}
}
}