IJ A assembly Version control ✓ Current File Alnstruction.java AssemblyFileParser.java Clnstruction.java instruction.java SymbolTable.java × 1 import java.util.HashMap; 08 2 3 public class SymbolTable { 4 сл 6 private static HashMap theTable; private static final String INITIAL_VALID_CHARS no usages = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMONPQRSTUVWXYZ_.$:"; no usages 7 private static final String ALL_VALID_CHARS = INITIAL_VALID_CHARS + "0123456789"; no usages 9 static { T To 13 14 15 16 17 19 23 24 25 26 27 TBCL222222222222201218 29 30 31 32 33 34 35 36 37 38 theTable = new HashMap<>(); // Initialize the table with predefined symbols theTable.put("R0", 0); theTable.put("R1", 1); } the Table.put("R2", 2); the Table.put("R3", 3); theTable.put("R4", 4); theTable.put("R5", 5); theTable.put("R6", 6); theTable.put("R7", 7); theTable.put("R8", 8); theTable.put("R9", 9); theTable.put("R10", 10); theTable.put("R11", 11); the Table.put("R12", 12); the Table.put("R13", 13); the Table.put("R14", 14); theTable.put("R15", 15); theTable.put("SCREEN", 16384); theTable.put("KBD", 24576); theTable.put("SP", 0); the Table.put("LCL", 1); the Table.put("ARG", 2); theTable.put("THIS", 3); theTable.put("THAT", 4); public static int getAddress(String symbol) { return theTable.get(symbol); 2 Q The file in the editor is not runnable Ctrl+

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 14RQ
icon
Related questions
Question

I am trying to Build the HACK architecture Assembler, in Java. Please see the screenshot of the error at the top right corner where it states "code is unrunnable" and help me please,  so that I can successfully run the AssemblyFileParser.java with a .asm file as input.

 

IJ
A assembly
Version control ✓
Current File
Alnstruction.java
AssemblyFileParser.java
Clnstruction.java
instruction.java
SymbolTable.java ×
1
import java.util.HashMap;
08
2
3
public class SymbolTable {
4
сл
6
private static HashMap<String, Integer> theTable;
private static final String INITIAL_VALID_CHARS
no usages
=
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMONPQRSTUVWXYZ_.$:";
no usages
7
private static final String ALL_VALID_CHARS = INITIAL_VALID_CHARS + "0123456789";
no usages
9
static {
T
To
13
14
15
16
17
19
23
24
25
26
27
TBCL222222222222201218
29
30
31
32
33
34
35
36
37
38
theTable = new HashMap<>();
// Initialize the table with predefined symbols
theTable.put("R0", 0);
theTable.put("R1", 1);
}
the Table.put("R2", 2);
the Table.put("R3", 3);
theTable.put("R4", 4);
theTable.put("R5", 5);
theTable.put("R6", 6);
theTable.put("R7", 7);
theTable.put("R8", 8);
theTable.put("R9", 9);
theTable.put("R10", 10);
theTable.put("R11", 11);
the Table.put("R12", 12);
the Table.put("R13", 13);
the Table.put("R14", 14);
theTable.put("R15", 15);
theTable.put("SCREEN", 16384);
theTable.put("KBD", 24576);
theTable.put("SP", 0);
the Table.put("LCL", 1);
the Table.put("ARG", 2);
theTable.put("THIS", 3);
theTable.put("THAT", 4);
public static int getAddress(String symbol) {
return theTable.get(symbol);
2 Q
The file in the editor is not runnable Ctrl+
Transcribed Image Text:IJ A assembly Version control ✓ Current File Alnstruction.java AssemblyFileParser.java Clnstruction.java instruction.java SymbolTable.java × 1 import java.util.HashMap; 08 2 3 public class SymbolTable { 4 сл 6 private static HashMap<String, Integer> theTable; private static final String INITIAL_VALID_CHARS no usages = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMONPQRSTUVWXYZ_.$:"; no usages 7 private static final String ALL_VALID_CHARS = INITIAL_VALID_CHARS + "0123456789"; no usages 9 static { T To 13 14 15 16 17 19 23 24 25 26 27 TBCL222222222222201218 29 30 31 32 33 34 35 36 37 38 theTable = new HashMap<>(); // Initialize the table with predefined symbols theTable.put("R0", 0); theTable.put("R1", 1); } the Table.put("R2", 2); the Table.put("R3", 3); theTable.put("R4", 4); theTable.put("R5", 5); theTable.put("R6", 6); theTable.put("R7", 7); theTable.put("R8", 8); theTable.put("R9", 9); theTable.put("R10", 10); theTable.put("R11", 11); the Table.put("R12", 12); the Table.put("R13", 13); the Table.put("R14", 14); theTable.put("R15", 15); theTable.put("SCREEN", 16384); theTable.put("KBD", 24576); theTable.put("SP", 0); the Table.put("LCL", 1); the Table.put("ARG", 2); theTable.put("THIS", 3); theTable.put("THAT", 4); public static int getAddress(String symbol) { return theTable.get(symbol); 2 Q The file in the editor is not runnable Ctrl+
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning