Question

In: Computer Science

-------------------------Don't give Incomplete Answer-------------- A compiler translates the code written in one language to some other...

-------------------------Don't give Incomplete Answer--------------

A compiler translates the code written in one language to some other language without changing the meaning of the program. It is also expected that a compiler should make the target code efficient and optimized in terms of time and space.

Compiler design principles provide an in-depth view of translation and optimization process. Compiler design covers basic translation mechanism and error detection & recovery. It includes lexical, syntax, and semantic analysis as front end, and code generation and optimization as back-end.

Why to Learn Compiler design?

Computers are a balanced mix of software and hardware. Hardware is just a piece of mechanical device and its functions are being controlled by a compatible software. Hardware understands instructions in the form of electronic charge, which is the counterpart of binary language in software programming. Binary language has only two alphabets, 0 and 1. To instruct, the hardware codes must be written in binary format, which is simply a series of 1s and 0s. It would be a difficult and cumbersome task for computer programmers to write such codes, which is why we have compilers to write such codes.

The LALR(1) parser is less powerful than the LR(1) parser, and more powerful than the SLR(1) parser, though they all use the same production rules. The simplification that the LALR parser introduces consists in merging rules that have identical kernel item sets, because during the LR(0) state-construction process the lookaheads are not known. This reduces the power of the parser because not knowing the lookahead symbols can confuse the parser as to which grammar rule to pick next, resulting in reduce/reduce conflicts. All conflicts that arise in applying a LALR(1) parser to an unambiguous LR(1) grammar are reduce/reduce conflicts. The SLR(1) parser performs further merging, which introduces additional conflicts.

S->BB

B->aB

B->b

LALR or not.clear draw all states and mark equal states cleary. draw LALR parsing table.

For the following (augmented) grammar:

-Construct the SLR sets of items and their Goto functions (the automaton).

-Indicate any action conflicts in your set of items.

-Construct the SLR parsing table if it exists.

S → SS + |SS*| a

Solutions

Expert Solution

2nd question for SLR is shown below:

Please let me know in case of any clarifications.


Related Solutions

-------------------------Don't give Incomplete Answer-------------- A compiler translates the code written in one language to some other...
-------------------------Don't give Incomplete Answer-------------- A compiler translates the code written in one language to some other language without changing the meaning of the program. It is also expected that a compiler should make the target code efficient and optimized in terms of time and space. Compiler design principles provide an in-depth view of translation and optimization process. Compiler design covers basic translation mechanism and error detection & recovery. It includes lexical, syntax, and semantic analysis as front end, and code...
Add the result envidented by the python compiler. use python language. 1(a) A Give the output...
Add the result envidented by the python compiler. use python language. 1(a) A Give the output for the array([ 0, 1, 8, 27, 64, 125, 216, 343, 512, 729]) a. a[:6:2] = -1000 (ii) a[ : :-1] ) b. Display the values of 1D array using for loop?
 c. Write a code to print a 3D array?
 d. How to print the transpose of a 2D array?
 e Write a function to sort the array row and coloumn wise ?...
Answer all. Don't answer just one! If you can't answer all then don't answer just one....
Answer all. Don't answer just one! If you can't answer all then don't answer just one. 14. You have accumulated $1,269.28 in credit card debt. Your interest rate is 14.75% per year and you will pay it off in 55 months. what will be your monthly payment? 15. You won the lottery. The money is paid in equal annual installments of $68,375 over 13 years beginning today. If the appropriate discount rate is 4.31%, how much is the sweepstakes actually...
Thinking in Assembly language What values will be written to the array when the following code...
Thinking in Assembly language What values will be written to the array when the following code executes? .data array DWORD 4 DUP(0) .code main PROC mov eax,10 mov esi,0 call proc_1 add esi,4 add eax,10 mov array[esi],eax INVOKE ExitProcess,0 main ENDP proc_1 PROC call proc_2 add esi,4 add eax,10 mov array[esi],eax ret proc_1 ENDP proc_2 PROC call proc_3 add esi,4 add eax,10 mov array[esi],eax ret proc_2 ENDP proc_3 PROC mov array[esi],eax ret proc_3 ENDP
posting for sec times Really don't want an incomplete answer I'll rate Maria Young is the...
posting for sec times Really don't want an incomplete answer I'll rate Maria Young is the sole stockholder of Purl of Great Price Company (POGP Company), which produces high-end knitted sweaters and sweater vests for sale to retail outlets. The company started in January of the current year, and employs three knitters (each of whom work 40 hours per week) and one office manager/knitting supervisor (this employee works 20 hours per week as office manager, and 20 hours per week...
Language: Java I have written this code but not all methods are running. First method is...
Language: Java I have written this code but not all methods are running. First method is running fine but when I enter the file path, it is not reading it. Directions The input file must be read into an input array and data validated from the array. Input file format (500 records maximum per file): comma delimited text, should contain 6 fields: any row containing exactly 6 fields is considered to be invalid Purpose of this code is to :...
I'll rate don't give me incomplete ans please thanks Rios Financial Co. is a regional insurance...
I'll rate don't give me incomplete ans please thanks Rios Financial Co. is a regional insurance company that began operations on January 1, Year 1. The following transactions relate to trading securities acquired by Rios Financial Co., which has a fiscal year ending on December 31: Record these transactions on page 10: Year 1 Feb. 1. Purchased 7,500 shares of Caldwell Inc. as a trading security at $50 per share plus a brokerage commission of $75. May 1. Purchased 3,000...
For each of the following questions, give the correct answer. However, don't just answer the question....
For each of the following questions, give the correct answer. However, don't just answer the question. For each answer choice, you have to provide at least a paragraph response on why that answer choice is correct or incorrect with relevant and outside information. Celery stalks that are immersed in fresh water for several hours become stiff and hard. Similar stalks left in a salt solution become limp and soft. From this we can deduce that the cells of the celery...
posting for second times I really don't want incomplete answer thanks I'll rate Job Order Cost...
posting for second times I really don't want incomplete answer thanks I'll rate Job Order Cost Sheet Remnant Carpet Company sells and installs commercial carpeting for office buildings. Remnant Carpet Company uses a job order cost system. When a prospective customer asks for a price quote on a job, the estimated cost data are inserted on an unnumbered job cost sheet. If the offer is accepted, a number is assigned to the job and the costs incurred are recorded in...
I post this question twice, please don't answer this post if you already answer the other...
I post this question twice, please don't answer this post if you already answer the other one, if you can answer different answer that's fine. REASON WHY I POST IT TWICE, I NEED TWO DIFFERENT VIEW. Discussion: Suicidal Crickets, Zombies Roaches and Other Parasites Tales Please watch the TED Talk ‘Suicidal crickets, zombies roaches and other parasite tales' and post something that you learn as well as whether you believe there could be parasites living inside of humans possibly controlling...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT