Write a lexical analyzer which reads a c- program

Assignment Help C/C++ Programming
Reference no: EM131391155

Write a lexical analyzer which reads a C- program, strips off comments (denoted by/* comments */), and generates four symbol tablets.

1. The KEYWORD table includes all keywords defined in Louden). Each keyword is associated with an index. You may combine the special symbols into the Keyword table. You may hardcode them.

Keyword Index
Else 1
If 2
int 3

2. The INDENTIFIER table includes all the user-defined identifiers. The table is similar to the keyword table except that it contains identifiers. Each identifier has its unique index.

3. The NUMBER table includes all integers and floats used in the program.

Num index attribute
60 1 integer
3.75 2 float

4. The TOKEN table includes all the tokens in the order that they are generated. The table should include the following information:

Token class index
Int kw 3
Gcd id 1
3.75 num 2

5. For the Regular Grammar for the tokens, refer to the Lexical Conventions of C- (Louden1). The input to your program is the example in Louden3 including the comments. Your program should strips off the comments.

6. The output from the program should include the program with comments stripped off. And all the tables mentioned above.

7. Please do file i/o, i.e. read the data from a file and send output to a file.

Attachment:- Attachments.rar

Reference no: EM131391155

Questions Cloud

Convert the program to a recirculating shift register : Download your design of part (c) to an FPGA IC. Discuss your observations of the q output LEDs with your instructor as you demonstrate the recirculating shift-right operation. Use a debounced switch for n_cp. (The DE-2 has debounced pushbuttons.)
Enzymes responsible for human digestion : What are the various organs and enzymes responsible for human digestion?
What are the stages of protein folding : How the structure of a protein is related to its function and what are the stages of protein folding?
What are the different parts of a plant : What are the different parts of a plant? How can each of the part be taken care?
Write a lexical analyzer which reads a c- program : Write a lexical analyzer which reads a C- program, strips off comments (denoted by/* comments */), and generates four symbol tablets.
Conditions the free energy change for the hydrolysis : Under standard conditions the free energy change for the hydrolysis of ATP is - 31 kJ/mol. What is the actual free-energy change for the reaction at 37oC and pH 7.0, where the concentrations of ATP, ADP and Pi are 8.8 mM, 1.3 mM and 5.5 mM, respec..
Confers a heterozygote advantage : Make up a new allele that confers a heterozygote advantage. State what happens when people are homozygous in both dominant and recessive states.
Treatment to some equipment : You want to give an ILD treatment to some equipment. You may use _____________.
Essay form and at least word scientific content : In essay form and at least 300 word Scientific content (accuracy; fact-supported; clarity; relevancy; paraphrased, i.e. no quotations). there has to be 6 or more in-text citations.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Program on basic arithmetic operation

Two integers must be compared before the arithmetic operation and Subtract the two integers provided the first integer is greater than the second integer, otherwise add the two integers and subtract the second integer from the first integer.

  Generate two files of 100 by 100 mazes

Write a C++ program that opens a file representing an encoded maze and reads it

  Find the largest element and print out the index and value

Write a function maxv() that returns the largest element of a vector argument. Find the largest element and print out the index and value.

  Explain roles of hardware and software components

Discussion is designed to help you understand the roles of hardware and software components in a modern computer system. For the purposes of this Discussion, assume that you are heading a team of 25 people working on a software development project..

  Write a program that performs character processing

Write a program that performs character processing on 10 characters read in from a file, and writes the results to output files. Do NOT use loops or arrays to solve this problem.

  Write a program to hold an array of 20 numbers read

Write a program to hold an array of 20 numbers read in from the keyboard and display them backwards. Use a array and a loop to cycle through the numbers.

  Length and the property line

Find the area, in acres, of the property shown in the figure below. The stream frontage is 141 feet in length and the property line is 500 feet in length. Round to two decimal places

  Separation performed by flash vaporization in a drum

Consider a vapor/liquid separation performed by flash vaporization in a drum:

  Load in the household configuration file

The first thing the program is required to do is load in the household configuration file, with the following  filename: housecfg.dat

  Compute the sum of the first

Assume there is a variable , h already associated with a positive integer value. Write the code necessary to compute the sum of the first h perfect squares, starting with 1 .

  Wrtie a function called gen_rand_double_array

Wrtie a function called gen_rand_double_array that generates 900 samples of size 22500 random numbers from U(10, 12). For each of these 900 samples, write a main funciton that calculates the mean and finds the simulated probability that the mean is b..

  Write a program in c which accepts 4 number

Write a program in C which accepts 4 numbers  from the user and stores them in an array. Using the pointer mathematics it traverses the array and get the sub of all the elements. Use only one pointer variable

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd