From 6ab162bdc850996e7f66350e8a65d63730f0f6aa Mon Sep 17 00:00:00 2001 From: Vipin Kumar Date: Sun, 27 Aug 2017 09:57:26 +0000 Subject: [PATCH] Change the labels to uppercase --- CodeWriter.java | 6 +++--- VMTranslator.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CodeWriter.java b/CodeWriter.java index c50e47a..b986c97 100644 --- a/CodeWriter.java +++ b/CodeWriter.java @@ -380,7 +380,7 @@ public void writeInit() { public void writeLabel(String label) { try { // Label LABEL - out.write("(" + label + ")"); + out.write("(" + label.toUpperCase() + ")"); out.newLine(); } catch (IOException e) { @@ -392,7 +392,7 @@ public void writeLabel(String label) { public void writeGoto(String label) { try { // goto LABEL - out.write("@" + label); + out.write("@" + label.toUpperCase()); out.newLine(); out.write("0;JMP"); out.newLine(); @@ -416,7 +416,7 @@ public void writeIf(String label) { out.newLine(); // jump to the label, if the value is not equal to 0 - out.write("@" + label); + out.write("@" + label.toUpperCase()); out.newLine(); out.write("D;JNE"); out.newLine(); diff --git a/VMTranslator.java b/VMTranslator.java index 88f8ce4..20d49de 100644 --- a/VMTranslator.java +++ b/VMTranslator.java @@ -2,7 +2,7 @@ * * Usage: java VMTranslator * - * Dependicies: Parser.java, CodeWriter.java + * Dependencies: Parser.java, CodeWriter.java * * - Constructs a Parser from input file * - Construct a CodeWriter to generate code in output file @@ -28,7 +28,7 @@ private void parse(File in) { String ctype = parser.commandType(); - // artithmetic command + // Arithmetic command if (ctype.equals("C_ARITHMETIC")) { code.writeArithmetic(parser.arg1()); }