Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use functional F# style for writing your programs. Make sure that you do not use mutable variables & loops. Any imperative style programming is prohibited

  • Use functional F# style for writing your programs.
  • Make sure that you do not use mutable variables & loops.
  • Any imperative style programming is prohibited unless specified in the problem description.

In this project you write a recursive descent parser for a specific grammar.

  1. Find your grammar definition in grammars.md file which corresponds to your ID.

MY GRAMMAR:

X  c | TbU | Xefc T  Uc | e | fX U  e 

Sentences:

  • fecbeefcbeefcefc
  • fcefcefcbe
  • ecbeefc
  • fecbebe
  • fecbebeefcefcefc
  1. Make appropriate changes to your grammar to convert it to the LL(1) form if necessary
    • No left recursion
    • Pairwise disjoint productions
  2. Write a recursive descent parser for your grammar. Your parser should output for every test sentence:
    • A test sentence itself
    • A list the grammar rules required to parse a correct sentence.
    • See a parsing example in rd-parser.ipynb script.
  3. Use provided sentences to test correctness of your parser.

MY GRAMMAR:

X  c | TbU | Xefc T  Uc | e | fX U  e 

Sentences:

  • fecbeefcbeefcefc
  • fcefcefcbe
  • ecbeefc
  • fecbebe
  • fecbebeefcefcefc

You recursive-descent parser must output list of grammar rules required to parse a valid sentence of produced by your grammar. Several sentences are provided to you. If case of the error in parser input, i.e. invalid sentence, your parser need to output error and terminate execution.

Solution

Place your LL grammar in the following cell:

place your LL grammar here

Place your recursive descent parser in the following cell:

In [ ]:

Place your recursive recursive descent parser tests in the following cell: 

In [ ]:

 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Accounting questions

Question

=+ (b) Do the same for p = 2.

Answered: 1 week ago

Question

Discuss the history of U.S. labor unions.

Answered: 1 week ago

Question

Evaluate the impact of unions on nurses and physicians.

Answered: 1 week ago

Question

Describe the impact of strikes on patient care.

Answered: 1 week ago