diff --git a/microcompiler.kt b/microcompiler.kt index 6f78e46..3f2406c 100644 --- a/microcompiler.kt +++ b/microcompiler.kt @@ -431,6 +431,13 @@ fun main(args: Array){ error(e.message ?: "Compilation failed with an unknown error", lineCount) } } + if(currentLine > 127){ + System.err.println("Instruction count overflow: $currentLine instructions") + System.exit(1) + } + + System.err.println("INFO: Microcompilation succeeded! Instruction count: $currentLine") + for(instr in insns) builder.append(instr.compiledValue.toInstruction()).append("\n") print(builder.toString()) diff --git a/weaver.kt b/weaver.kt index fcaf30a..53b2b52 100644 --- a/weaver.kt +++ b/weaver.kt @@ -145,7 +145,7 @@ fun main(args: Array){ val value = rawValue.replace(" ", "").replace("\t", "") if(value.length == 0 || value.startsWith("#")) continue - else if((weaveUCode && index() >= state.microMemory.size) || (!weaveUCode && index() >= state.programMemory.size)) error("Program memory out of bounds! Did you pass too much data?") + else if((weaveUCode && index() >= state.microMemory.size) || (!weaveUCode && index() >= state.programMemory.size)) error("Memory out of bounds: ${index()}! Did you pass too much data?") else if(value.startsWith("@")){ if(value == "@u") weaveUCode = true else if(value == "@p") weaveUCode = false