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 smooth steel ball 1-cm in diameter (W 0.04 N) is fired vertically at sea level at an initial velocity of 1000 m/s. Its drag coefficient is given by Fig. 7.20. Assuming a constant speed of sound...
-
In the equally tempered scale to which keyed instruments have been tuned since the days of J.S. Bach (1685-1750), the frequencies of successive notes C, C#, D, D#, F, F#, G, G#, A, A#, B, C from a...
-
During a refrigeration cycle, heat is rejected by the refrigerant in (a) compressor (b) condenser (c) evaporator (d) expansion valve
-
The adjusted trial balance for Rochester Electronics, Inc. on November 30, the end of its first month of operation, is as follows: The general ledger reveals the following additional data: a. There...
-
Tina Keperwes went to a Publix Supermarket (Publix) in Florida and bought a can of Doxsee brand clam chowder. Keperwes opened the can of soup and prepared it at home. While eating the chowder, she...
-
A number of cities are arranged on a graph that has been divided up like an ordinary Cartesian plane. Each city is located at an integral (x, y) coordinate intersection. City names and locations are...
-
Suppose you own a fleet of vans which cost you per van: Initial cost of $30k; Annual cost of $12k in the 1st year, $15k in the 2nd, $20 in the 3rd, $25 in the 4th; the salvage value is $20k at the...
-
- b. Suppose you are considering two possible investment opportunities: a 12-year Treasury bond and a 7-year, AA-rated corporate bond. The current real risk-free rate is 5%, and inflation is expected...
-
(f) If the normal strain is zero in the z direction, calculate the stress in the z direction provided that; (3) ox = 16 MPa; y = 12 MPa; E = 70 GPa; G = 28 GPa; v = 0.25 Z 8. = 0 T X = ? Answer (g)...
-
c) In Fig. 3 straight arrows represent scheduler activations, s-shaped symbols represent user-level threads, and the cluster of user-level threads to the right of the pane represents the ready list....
-
Accounting records for The Ralston Company show the following for the most recent fiscal year: Units produced and sold 59,500 Total revenues and costs Sales revenue $ 371,600 Direct materials costs...
-
Ayie decided to retired from the partnership on 1 September 20x7 due to illness. The goodwill is valued at RM120,000 on the retirement date. Goodwill account will not be maintained in the books. A...
-
Ques = A mass m String haugs firem a fixed paint fixed point by a light #f a small verticle arcillation I is the length of string in equilibrium and in d number of oncillation per second, show that...
-
Discuss the concept of the looking-glass self. how do you think others perceive you? do you think most people perceive you correctly?
-
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.
-
Use the code given earlier for R to make this plot. The command would be plot(percentage)
-
Why would you not feel comfortable computing a Pearson correlation on the data in Exercise 9.10? Exercise 9.10 Down syndrome is another problem that psychologists deal with. It has been proposed that...
-
In Exercise 9.1 the percentage of mothers over 40 does not appear to be important, and yet it is a risk factor in other societies. Why do you think that this might be? Exercise 9.1 In Sub-Saharan...
Study smarter with the SolutionInn App