Grammar Analysis

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.

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
Make appropriate changes to your grammar to convert it to the LL(1) form if necessary
No left recursion
Pairwise disjoint productions
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.
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 [ ]:

Add New

Place your recursive descent parser tests in the following cell:
In [ ]:

This question has been answered.

Get Answer