File tree Expand file tree Collapse file tree 4 files changed +13
-2
lines changed
src/main/java/org/example Expand file tree Collapse file tree 4 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1+ //Simple program that adds 1 and then 2 to the register 0x00
2+ ADD 0xFF01 0xFF00 0x0000
3+ PRNT 0x0000 0x0000 0x0000
4+ ADD 0xFF01 0x0000 0x0000
5+ PRNT 0x0000 0x0000 0x0000
Original file line number Diff line number Diff line change @@ -45,8 +45,12 @@ public static byte[] compilar(String arquivo){
4545
4646 String [] linhas = arquivo .split ("\n " );
4747 for (String linha : linhas ){
48+
49+ if (linha .contains ("//" ))
50+ continue ;
51+
4852 System .out .println ("Linha sendo processada: " +linha );
49- String [] elementos = linha .split (" " );
53+ String [] elementos = linha .split ("\\ s+ " );
5054 if (elementos .length != 4 )
5155 return null ;
5256 String opcodeString = elementos [0 ];
@@ -108,7 +112,9 @@ public static void main(String[] args) {
108112
109113 String arquivo = lerArquivo (nomeArquivo );
110114 try (FileOutputStream f = new FileOutputStream ("a.bin" )){
111- f .write (compilar (arquivo ));
115+ byte [] bytesToWrite = compilar (arquivo );
116+ if (bytesToWrite != null )
117+ f .write (bytesToWrite );
112118 } catch (IOException e ) {
113119 throw new RuntimeException (e );
114120 }
You can’t perform that action at this time.
0 commit comments