Write a lexical analyzer which reads a c- program

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

Program Assignment

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, pp.491). 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.

Reference no: EM13944937

Questions Cloud

Which car will she buy in order to maximize her utility : The BMW that she wants sells for $37,220, while the Mitsubishi sells for $28,200. She can afford either car. Which car will she buy in order to maximize her utility?
About the retirement goal : Your retirement goal is to save $400,000 by the time you are 65 years old. You have been saving $926.65 per year for the last 30 years, and you will retire in 5 years (at age 65). The interest rate has just changed from 12% (which has been the level ..
What is the cost of equity for the corporation : The expected return on the market is 12%. The risk-free rate is 3.5%. The corporation has a current stock price of $65. There are 15 million shares outstanding. The beta for the stock is 1.6. What is the cost of equity for the corporation? What is bo..
What is the stock value : A company has an issue of preferred stock outstanding that pays an annual dividend of $6.20. If the discount rate for the stock is 11%, what is the stock's value
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.
Download a shareware version of some commercial software. : Download a shareware version of some commercial software. Design a plan for converting the shareware version to a full version without paying one cent.
Perform a two-sided hypothesis test : Is the sample evidence sufficient to conclude which suburb spends more? To answer this question,perform a two-sided hypothesis test at  = .05. State the alternative and null hypotheses, computethe observed significance level (p-value), and state t..
What is the company cost of new equity : Riverhawk Store (RS) dividends have been growing at 3 percent annually and are expected to continue this growth rate indefinitely. The company recently paid a dividend of $1.25 per share. Next year, it expects to add $3 million to retained earnings. ..
Determine the break-even point : A company has estimated fixed costs of $150,000 and estimated variable costs of $25 per unit. It is projected that 4,000 units will be sold at a selling price of $50 per unit. Determine the break-even point

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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