File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -67,9 +67,6 @@ public class CodeWriter {
6767 } catch (IOException e ) {
6868 throw new RuntimeException (e ); // rethrow the exception as an unchecked exception
6969 }
70-
71- // write the bootstrap code to initialize the VM
72- writeInit (); //TODO: implement commandline argument to disable the bootstrap code
7370 }
7471
7572 /**
Original file line number Diff line number Diff line change @@ -34,6 +34,9 @@ public static void main (String[] args) {
3434 outputFileName = input .getPath () + File .separator + outputFileName ; // concatenate the directory name with the output file name
3535 codewriter = new CodeWriter (outputFileName ); // instantiate the CodeWriter class
3636
37+ // write the bootstrap code to initialize the VM when translating a directory
38+ codewriter .writeInit ();
39+
3740 File [] files = input .listFiles ();
3841 if (files == null ) {
3942 System .out .println ("No files found in directory: " + inputFileName );
@@ -60,6 +63,9 @@ public static void main (String[] args) {
6063 outputFileName = inputFileName .substring (0 , inputFileName .lastIndexOf ('.' )) + ".asm" ; // replace .vm with .asm
6164 codewriter = new CodeWriter (outputFileName ); // instantiate the CodeWriter class
6265
66+ // Do not write the bootstrap code when translating a single file. Otherwise online grader will fail.
67+ Debug .println ("Skipping writing bootstrap code to output file" );
68+
6369 Parser parser = new Parser (inputFileName ); // unique parser object for each file per API
6470 parseInput (parser , inputFileName , codewriter ); // shared output file
6571 }
You can’t perform that action at this time.
0 commit comments