Assignment # 3: Compiler Construction Q1: Create a Programming language grammar which contains the following syntax:...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Assignment # 3: Compiler Construction Q1: Create a Programming language grammar which contains the following syntax: 1: Program block (like, main ()) 2: Variable declaration statement (at least accepts any four data types with arrays) 3: At least one looping statement 4: At least one decision statement 5: Expression Statement 6: Function declaration and definition Q2: Create CLR machine for the developed grammar Q3: Use any sample code according to the developed grammar and generate a stack table to validate the code. a. For the following C++ code: int LimSquare (x) int y; { } Compiler Construction /* returns y squared, but never more than 100 */ return (y = 10) ? 100: y*y; 1. List all lexemes and tokens 2. List all tokens that will have entries in the Symbol Table b. Complete the following grammar written for deceleration statements in C programming language, only for VarDeclare, so it can derive similar strings like the following input (Note: x can be any valid identifier): float x; 1. prog 2. stmts 3. stmt stmts stmt; | stmts stmt; | { stmts} DeclareStmts 4. DeclareStmts VarDeclare | FunDeclare Assignment # 3: Compiler Construction Q1: Create a Programming language grammar which contains the following syntax: 1: Program block (like, main ()) 2: Variable declaration statement (at least accepts any four data types with arrays) 3: At least one looping statement 4: At least one decision statement 5: Expression Statement 6: Function declaration and definition Q2: Create CLR machine for the developed grammar Q3: Use any sample code according to the developed grammar and generate a stack table to validate the code. Assignment # 3: Compiler Construction Q1: Create a Programming language grammar which contains the following syntax: 1: Program block (like, main ()) 2: Variable declaration statement (at least accepts any four data types with arrays) 3: At least one looping statement 4: At least one decision statement 5: Expression Statement 6: Function declaration and definition Q2: Create CLR machine for the developed grammar Q3: Use any sample code according to the developed grammar and generate a stack table to validate the code. a. For the following C++ code: int LimSquare (x) int y; { } Compiler Construction /* returns y squared, but never more than 100 */ return (y = 10) ? 100: y*y; 1. List all lexemes and tokens 2. List all tokens that will have entries in the Symbol Table b. Complete the following grammar written for deceleration statements in C programming language, only for VarDeclare, so it can derive similar strings like the following input (Note: x can be any valid identifier): float x; 1. prog 2. stmts 3. stmt stmts stmt; | stmts stmt; | { stmts} DeclareStmts 4. DeclareStmts VarDeclare | FunDeclare a. For the following C++ code: int LimSquare (x) int y; { } Compiler Construction /* returns y squared, but never more than 100 */ return (y = 10) ? 100: y*y; 1. List all lexemes and tokens 2. List all tokens that will have entries in the Symbol Table b. Complete the following grammar written for deceleration statements in C programming language, only for VarDeclare, so it can derive similar strings like the following input (Note: x can be any valid identifier): float x; 1. prog 2. stmts 3. stmt stmts stmt; | stmts stmt; | { stmts} DeclareStmts 4. DeclareStmts VarDeclare | FunDeclare
Expert Answer:
Related Book For
Cambridge International AS & A Level Computer Science
ISBN: 9781510457591
1st Edition
Authors: David Watson, Helen Williams
Posted Date:
Students also viewed these programming questions
-
Arvind runs a small electronics company in India and has just sold some equipment to a U.S. company for $1 million to be paid in 90 days. His cost in Indian Rupees (INR) is 60 million. The current...
-
Donatello Lake Resort reported the following on its balance sheet at December 31, 2016: Property, plant, and equipment, at cost: Land .................................... $ 145,000 Buildings...
-
Western University is growing steadily, as measured by the number of courses listed, the number of course sections taught, and the number of student enrolled. The increased growth has led to...
-
If you are preparing a client for a deposition, what rules for responding to deposition questions should you review with the client?
-
The system shown is in equilibrium when en = 0. Knowing that initially =90? and that block C is given a slight nudge when the system is in that position, determine the velocity of the block as it...
-
You need to estimate a number of portfolios for two different investors and discuss the implications for diversification. Key information on portfolio construction is as follows: Investor utility is...
-
Many Americans care deeply about what they eat and feed their family. They fear conventional factory farming, wish to be good stewards of the environment, and desire a sustainable lifestyle....
-
Briefly describe a team conflict you observed or were involved in that had negative results. Based on the steps described in the video, how could have the team leader better managed the conflict?...
-
Identify at least five metrics to measure your company's marketing performance Describe what aspects of your marketing strategy (customer satisfaction, product performance, and so on) each metric...
-
1. Given: a cash flow of $200 occurring in year four, and annual interest rate is 12%. a. Calculate the present value of the cash flow if interest is calculated once a year. b. Calculate the present...
-
What is Brazos partners investment strategy? Does is seem well-suited for a first-time fund? Assess the merits of the GTT transaction? How does the current recessionary climate affect Brazos'...
-
How can a company's organizational structure either foster or hinder innovation, and what strategies can be implemented to create a structure that encourages creativity and experimentation ?
-
A mass flow sensor measures the mass of air into an engine resulting in the following data. Mass is in [kg/min], output in [V]: M [kg/min] Output [V] M [kg/min] Output [V] M [kg/min] Output [V] 0...
-
1. What are the difficulties in differentiating the social,local, and mobile marketing channels? 2. What is meant by the social marketing term amplificationand how is it created and measured? 3. What...
-
Suppose that a business sells 6-month subscriptions to its monthly magazine. On January 1, the company receives a total of $600 for 10 subscriptions. To record this transaction, the company debits...
-
Procedures and functions are subroutines. Explain what is meant by a) A procedure b) A function c) A parameter d) A procedure or function header.
-
a) Convert the denary number 95 into binary coded decimal (BCD). b) Using twos complement, carry out the binary subtraction: 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 0 And convert your answer into denary. c)...
-
a) This table shows some statements about circuit switching and packet switching. Copy the table and indicate which statements are true () and which are false (). b) Explain the following terms and...
-
Determine the reactions at the pin support \(A\) and roller \(B\). 500 lb/ft 30 ft 700 lb/ft 48 ft- 48 ft BA 20 ft B
-
For methanol synthesis reaction \[ \mathrm{CO}(\mathrm{g})+2 \mathrm{H}_{2}(\mathrm{~g}) ightleftharpoons \mathrm{CH}_{3} \mathrm{OH}(\mathrm{g}) \] Using a feed mixture of carbon monoxide and...
-
The L2 steel blade of the band saw wraps around the pulley having a radius of \(12 \mathrm{in}\). Determine the maximum normal stress in the blade. The blade has a width of 0.75 in. and a thickness...
Study smarter with the SolutionInn App