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.
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
|