This commit is contained in:
Gašper Dobrovoljc 2025-06-03 17:04:14 +02:00
parent 7e9e25b77b
commit 1b45d6a0f9
No known key found for this signature in database
GPG Key ID: 0E7E037018CFA5A5
4 changed files with 15 additions and 23 deletions

View File

@ -414,11 +414,9 @@ public class CodeGen {
case Mem.RelAccess relAccess -> {
String initLabel = "$init:" + varDef.name + "@" + loc.location().begLine() + ":" + loc.location().begColumn();
data.add(new PDM.LABEL(initLabel, loc));
if (relAccess.inits != null) {
for (Integer init : relAccess.inits) {
data.add(new PDM.DATA(init, loc));
}
}
code.add(new PDM.PUSH(-relAccess.size, loc));
code.add(new PDM.POPN(loc));

View File

@ -28,12 +28,12 @@ public class Machine {
/**
* Ali se opravi testni izpis ukazov.
*/
public static boolean debugInstrsList = true;
public static boolean debugInstrsList = false;
/**
* Ali se opravi testni izpis vrednost oznak.
*/
public static boolean debugLabelsList = true;
public static boolean debugLabelsList = false;
/**
* Ali se opravi testni izpis dogajanja na skladu.

View File

@ -230,7 +230,7 @@ public class Memory {
int parOffset = 4; // +SL
Vector<Mem.RelAccess> debugPars = new Vector<>();
for (AST.ParDef parDef : funDef.pars) {
Mem.RelAccess access = new Mem.RelAccess(parOffset, frameBuilder.depth, 4, null, parDef.name);
Mem.RelAccess access = new Mem.RelAccess(parOffset, frameBuilder.depth, 4, new Vector<>(), parDef.name);
parOffset += access.size;
debugPars.add(access);
attrAST.attrParAccess.put(parDef, access);
@ -285,7 +285,6 @@ public class Memory {
if (varDef.inits.size() == 0) {
size = 4;
inits = null;
}
if (frameBuilder == null) {
@ -329,17 +328,12 @@ public class Memory {
public static Integer decodeChrConst(final AST.AtomExpr chrAtomExpr, final Report.Locatable loc) {
switch (chrAtomExpr.value.charAt(1)) {
case '\\':
switch (chrAtomExpr.value.charAt(2)) {
case 'n':
return 10;
case '\'':
return ((int) '\'');
case '\\':
return ((int) '\\');
default:
return 16 * (((int) chrAtomExpr.value.charAt(2)) - ((int) '0'))
+ (((int) chrAtomExpr.value.charAt(3)) - ((int) '0'));
}
return switch (chrAtomExpr.value.charAt(2)) {
case 'n' -> 10;
case '\'' -> ((int) '\'');
case '\\' -> ((int) '\\');
default -> Integer.parseInt(chrAtomExpr.value.substring(2, 4), 16);
};
default:
return ((int) chrAtomExpr.value.charAt(1));
}
@ -371,8 +365,7 @@ public class Memory {
c += 1;
break;
default:
value.addLast(16 * (((int) strAtomExpr.value.charAt(c + 1)) - ((int) '0'))
+ (((int) strAtomExpr.value.charAt(c + 2)) - ((int) '0')));
value.addLast(Integer.parseInt(strAtomExpr.value.substring(c + 1, c + 3), 16));
c += 2;
break;
}

5
zip.sh
View File

@ -6,8 +6,9 @@ read -r phase
mkdir pins25
rsync -av --exclude=".*" ./src ./pins25
mkdir ./pins25/prg
cp ./prg/Makefile ./pins25/prg
rm ./pins25/prg/*.pins25
#cp ./prg/Makefile ./pins25/prg
#rm ./pins25/prg/*.pins25
cp -r ./prg ./pins25
rm 63230048-"$phase".zip
zip -r 63230048-"$phase".zip ./pins25
rm -rf ./pins25