Question: Java Programming: Below is the ProgramNode extends Node.java file. There are errors in the code so please fix those errors. The errors are in lines

Java Programming: Below is the ProgramNode extends Node.java file. There are errors in the code so please fix those errors. The errors are in lines 13, 55, 56, 57, 58, 59, 60, 62, 63, 64, 65, 67, 68, 69, 72, 79, 80, 99, 100, 105, 106, 107, 113, 114, and 127. There must be no errors at all. Attached is the rubric that is circled in black all the components the ProgramNode extends Node.java file must have.

ProgramNode.java

package mypack;

import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;

import mypack.Token.TokenType;

public class ProgramNode extends Node {

private Map functions;

public ProgramNode(Map functions) { this.functions = functions; }

public Map getFunctions() { return functions; }

public void setFunctions(Map functions) { this.functions = functions; }

public String toString() { return "ProgramNode [functions=" + functions + "]"; }

public FunctionNode function() { if(checkToken("define")) { nextToken(); String name = getToken(TokenType.IDENTIFIER); nextToken(); if(checkToken("(")) { nextToken(); List parameters = parameterDeclarations(); if(checkToken(")")) { nextToken(); if(checkToken(TokenType.ENDOFLINE)) { nextToken(); List constants = constantDeclarations(); List variables = variableDeclarations(); if(checkToken(TokenType.INDENT)) { nextToken(); List statements = new ArrayList(); while(true) { StatementNode statement = expression(); if(statement == null) { break; } else { statements.add(statement); } } if(checkToken(TokenType.DEDENT)) { nextToken(); return new FunctionNode(name, parameters, constants, variables, statements); } } } } } } return null; }

public List parameterDeclarations() { List parameters = new ArrayList(); while(true) { boolean changeable; if(checkToken("var")) { nextToken(); changeable = true; } else { changeable = false; } String name = getToken(TokenType.IDENTIFIER); nextToken(); Node type = factor(); if(type == null) { break; } VariableNode variable = new VariableNode(name, changeable, type); parameters.add(variable); if(checkToken(",")) { nextToken(); } else { break; } } return parameters; }

public List constantDeclarations() { List } }

Java Programming: Below is the ProgramNode extends Node.java file. There are errors

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!