Objective: Learn programming language implementation systems that includes lexical and syntax analysis. Practice conducting lexical and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Objective: Learn programming language implementation systems that includes lexical and syntax analysis. Practice conducting lexical and syntax analysis on given program components. Assignment: Language implementation systems must input a file, identify substrings, and find all syntax errors, regardless of the specific implementation approach. For an input program a lexical analyzer will break a file into lexemes. A parser will find all syntax errors. For each error the parser will produce an appropriate diagnostic message and recover quickly. For the Try Program defined as follows, choose a programming language Java or C++, to implement a lexical analyzer and a top-down parser. The lexical analyzer will read the try program and generate lexemes with token types. The parser must use the recursive-descending parsing algorithm to implement the syntax analysis. The project must implement the following functions: 1. Input the try program. 2. Use the Lexical Analyzer to generate lexemes and corresponding tokens, and display them. 3. Use the recursive-descending parser to check the syntax of the try program. 4. If the try program is generated by the BNF grammar for Try Program, your program should display "The try program is generated by BNF grammar for Try Program", otherwise identify the first syntax error and display "The first syntax error is (Give identified error)". Requirements: You should use department programming standards. The program must be executed correctly. BNF grammar for Try Program: 544 44-44 >> ( ) { } ; ; = ; (+-) float | void a Test your program using the following try programs as input files. First try program: void try (float temp) { float data; float number; float sum; sum = temp + data - number; } Second try program: void try () { float number; float sum; float temp; sum temp-number; } If I Objective: Learn programming language implementation systems that includes lexical and syntax analysis. Practice conducting lexical and syntax analysis on given program components. Assignment: Language implementation systems must input a file, identify substrings, and find all syntax errors, regardless of the specific implementation approach. For an input program a lexical analyzer will break a file into lexemes. A parser will find all syntax errors. For each error the parser will produce an appropriate diagnostic message and recover quickly. For the Try Program defined as follows, choose a programming language Java or C++, to implement a lexical analyzer and a top-down parser. The lexical analyzer will read the try program and generate lexemes with token types. The parser must use the recursive-descending parsing algorithm to implement the syntax analysis. The project must implement the following functions: 1. Input the try program. 2. Use the Lexical Analyzer to generate lexemes and corresponding tokens, and display them. 3. Use the recursive-descending parser to check the syntax of the try program. 4. If the try program is generated by the BNF grammar for Try Program, your program should display "The try program is generated by BNF grammar for Try Program", otherwise identify the first syntax error and display "The first syntax error is (Give identified error)". Requirements: You should use department programming standards. The program must be executed correctly. BNF grammar for Try Program: 544 44-44 >> ( ) { } ; ; = ; (+-) float | void a Test your program using the following try programs as input files. First try program: void try (float temp) { float data; float number; float sum; sum = temp + data - number; } Second try program: void try () { float number; float sum; float temp; sum temp-number; } If I
Expert Answer:
Answer rating: 100% (QA)
Below is the program that demonstrates the basic structure and key components java import javautil public class TryProgramParser private static String ... View the full answer
Related Book For
Accounting Information Systems
ISBN: 9780132871938
11th Edition
Authors: George H. Bodnar, William S. Hopwood
Posted Date:
Students also viewed these programming questions
-
Dr. Ivano Payne Just Bought An Audi TTS Coupe For $69,263.14 (Taxes Included). Audi Offered Her Financing At 1.9% (APR) And Her Monthly Payments (Over A 60-Month Term) Are $1,211.00. At The End Of...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
List three specific parts of the Case Guide, Objectives and Strategy Section (See below) that you had the most difficulty understanding. Describe your current understanding of these parts. Provide...
-
For the inexperienced marketer, the similar-but-different aspect of culture creates an illusion of similarity that usually does not exist. Discuss and give examples.
-
A relativistic rocket emits a gas jet with non-relativistic velocity u constant relative to the rocket. Find how the velocity v of the rocket depends on its rest mass m if the initial rest mass of...
-
On July 3, 2009, Devin purchased 100 shares of CDEF stock at a price of $30 per share. The commission paid was $29. He sold his shares on July 6, 2011, at a price of $45 per share and the commission...
-
Explain why there must be a mistake in each of the following statements: (a) The probability that a mineral sample will contain silver is 0.38 and the probability that it will not contain silver is...
-
What conditions suggest that a ratio variable should be transformed (recoded) into a dichotomous (two group) variable?
-
x Bond Issue B (A) Cash Interest Paid $600,000.0 (B) Period Interest Expense Period 12.0% x (E) x 12.5% Ending 3/12 x 3/12 (C) Amort. (A) - (B) (D) (E) Carrying Value Unamortized $600,000 Balance (D)...
-
(a) Write a Python function called lroot to calculate the largest root of the quadratic equation ax +bx+c= 0. Your function should take the coefficients a, b and c as arguments and return the largest...
-
19. Peters & Co manufactures casings for toy drones. The standard cost of this product is as follows: Material X 8kg At $4/kg 32.00 Material Y 4kg At $7/kg 28.00 Labour 3 hours At $17/hour 51.00...
-
An adult, male giraffe has a blood pressure on the order of $37 \mathrm{kPa}$ above atmospheric pressure. How high can the giraffe heart pump a column of blood with specific gravity of 1.06 ?
-
What is the pressure one mile $(1.6 \mathrm{~km})$ beneath the ocean's surface?
-
Your coworker has scribbled down the saturation pressures for a pure species from the solid (sublimation) and liquid (evaporation) as follows: and, However, in his haste, he forgot to note which...
-
Coherent green light of wavelength \(530 \mathrm{~nm}\) passes through two very narrow slits separated by \(1.00 \mu \mathrm{m}\). What is \((a)\) the angular location of the first-order bright...
-
At what pressure will water boil at $65^{\circ} \mathrm{C}$ ? The vapor pressure of water can be determined from the Antoine equation: \[\frac{P(P a)}{1 \times...
-
Describe and discuss the Spanish/Mexican view towards theprovince of California: why didnt the area develop under Spanishrule? What obstacles retarded its settlement?
-
Research an article from an online source, such as The Economist, Wall Street Journal, Journal of Economic Perspectives, American Journal of Agricultural Economics, or another academic journal. The...
-
The database administrator (DBA) is not necessarily a single individual. In a large organization, several individuals may share overall responsibility for the DBA function. Discuss each of the...
-
A specific project task has been estimated to require 100 work hours to complete. Using the adjustment factors in Figures 12.7 and 12.8, adjust this estimate to reflect the following. Figure 12.7...
-
Identify the general steps in the procurement process.
-
What are the differences among an onsite team, a virtual team, a task force, and a committee? What are some of the potential differences in dynamics between people in these different groups?
-
What are the benefits of implementing programs to address cultural competence within a health care organization? What are the costs of not implementing such programs?
-
Over the past month, every member of the Intravenous (IV) Therapy Team has complained to you about the IV Team supervisor. Her direct reports, all RNs, agree that she is technically superb. However,...
Study smarter with the SolutionInn App