Question: This is a COMPILER CONSTRUCTION related task (as well as C coding language). It has two parts. For each Task, you're required to also include

 This is a COMPILER CONSTRUCTION related task (as well as C

coding language). It has two parts. For each Task, you're required to

This is a COMPILER CONSTRUCTION related task (as well as C coding language).

It has two parts.

For each Task, you're required to also include a neatly titled and structured report after the task.I will edit it myself if it needs any changes so don't worry too much about that.

Apart from that, please solve both Tasks on paper in hand written form. If you genuinely can't do it on paper, then use your computer. I'll just copy it down on paper myself.

Please only answer if you can do this correctly. I am eagerly waiting for your Answer and I will immediately leave a thumbs up and also comment for you.

I need this done soon.

Thank you.

Important: You need to include a well formatted and well written report for this task. The report should be placed after the answers to Task 1 and Task 2 (just label it as "REPORT" and I will set it's positioning myself after you submit the work). The report should include the following sections: - Introduction about the problem in hand. - Your short code segments followed by a detailed description explaining how you built up the logic of the given code snippet. - If you have used some user defined functions in your code make sure to given a detailed description about their working. - Additional functionalities and / or exclusions (if any) should be stated with separate heading in bold face font. - Code description should be augmented (if possible) by the screen shots of the output for that piece of code to make your description clearer and more concise. Task 1: In this task you need to write a code in C that will implement the functionality of "Stack Implementation Table" for the LR(0) parser. Here is the grammar that you will use: E BBBCBBd Some of the possible valid input strings that we can generate from this grammar are: \{cdd, ccdd, cccdd, ccccdd, cccccdd ...\} Your task is to follow all the steps which include, - Augmenting the grammar. - Drawing the LR(0) item sets for the given grammar. Now you will list down the parse table for the LR(0) parser. Note that all the above steps should be completed using paper and pencil. Make sure to incorporate these in your report as well. Now that we have listed down the parse table for the parser, you need to write a program using C language. Your program should accept a string on command line argument and list down the complete stack implementation table on screen for the LR(0) parser showing whether the string is accepted or rejected. Note that you must incorporate appropriate checks in your program. Some of these may be: - Check that user must provide \$ symbol in her input. - The input string must consist of alphabets only. No numeric or special character (except one $ symbol at the end of the string) are allowed. Once you are done with the program test it using different strings and choose at least three valid and three invalid inputs for your program. Include the screen shots of the output in your report. A sample run for your convenience: For LR(0) parser: $ gcc Ir.c 0 lr $. /rr ccdd\$ The output is as shown below: In this task you need to write a code in C that will implement the functionality of "Stack Implementation Table" for the LL(1) parser. Here is the grammar that you will use: SAaABDBbDd Some of the possible valid input strings that we can generate from this grammar are: {a,ba,da,bda} Your task is to follow all the steps which include, - Listing down the FIRST and FLLOW sets of all the non-terminal symbols in the grammar. - List down the LL(1) parsing table. Note that all the above steps should be completed using paper and pencil. Make sure to incorporate these in your report as well. Now that we have listed down the parse table for the parser, you need to write a program using C language. Your program should accept a string on command line argument and list down the complete stack implementation table on screen for the LL(1) parser showing whether the string is accepted or rejected. Note that you must incorporate appropriate checks in your program. Some of these may be: - Check that user must provide $ symbol in her input. - The input string must consist of alphabets only. No numeric or special character (except one $ symbol at the end of the string) are allowed. Once you are done with the program test it using different strings and choose at least three valid and three invalid inputs for your program. Include the screen shots of the output in your report. A sample run is provided for your convenience. For LL(1) parser: $gCc11.CO1l $./11 bda\$ The output is as shown below

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!