Question
IF some culd really help me with this i'd really appreciate it it's due today at 11 pm and i've tried everything but it's not
IF some culd really help me with this i'd really appreciate it it's due today at 11 pm and i've tried everything but it's not working. Objective: Build a compiler for Jack -- a modern, object-based, Java-like language. The compiler construction spans two projects: 10 (Syntax Analysis) and 11 (Code Generation). In this project we build a syntax analyzer that parses programs according to the Jack grammar, producing an XML file that reflects the program's structure. Resources: The main tool in this project is the programming language in which you will implement the syntax analyzer. You will also need the TextComparer utility (available in your tools directory, assuming that you've installed the TECS software suite), which allows comparing the output files generated by your analyzer to the compare files supplied by us. You may also want to inspect the generated and supplied output files using an XML viewer (any standard web browser should do the job). All the test files necessary for this project are available in project 10.zip. Start by creating a directory named projects/10 on your computer, then extract this file into it (preserving the directory structure embedded in the zip file). files in the zip are:
main txt file:
// This file is part of the materials accompanying the book
// "The Elements of Computing Systems" by Nisan and Schocken,
// MIT Press. Book site: www.idc.ac.il/tecs
// File name: projects/10/ArrayTest/Main.jack
/** Computes the average of a sequence of integers. */
class Main {
function void main() {
var Array a;
var int length;
var int i, sum;
let length = Keyboard.readInt("HOW MANY NUMBERS? ");
let a = Array.new(length);
let i = 0;
while (i < length) {
let a[i] = Keyboard.readInt("ENTER THE NEXT NUMBER: ");
let i = i + 1;
}
let i = 0;
let sum = 0;
while (i < length) {
let sum = sum + a[i];
let i = i + 1;
}
do Output.printString("THE AVERAGE IS: ");
do Output.printInt(sum / length);
do Output.println();
return;
}
}
and the other one;
main T:
-
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started