Your Perfect Assignment is Just a Click Away

Starting at $8.00 per Page

100% Original, Plagiarism Free, Customized to Your instructions!

glass
pen
clip
papers
heaphones

CSCI 3136 Regular Expression and Context Free Grammar Paper

CSCI 3136 Regular Expression and Context Free Grammar Paper

Question Description

We use regular expressions to describe regular languages. Regular expressions are themselves stringsover an alphabet including regular characters and special characters such as parentheses, “.”, “|”, and“*”. The string “.*(1.1|1..1).*” is a valid regular expression while the string “((10|)(” is not.This language turns out not be regular (because it includes strings with arbitrarily deeply nested sets ofparentheses). Let us assume we have already constructed a scanner that identifies the tokens regularexpressions are composed of.1 The tokens we are allowed to build regular expressions from are( ) | . * + ? charwhere char denotes any valid character of the underlying alphabet. You don’t have to worry aboutrecognizing valid characters; we assume the scanner takes care of this for us.

(a) Provide a context-free grammar that defines the language of regular expressions. As is customary,assume that each input string is terminated by a special end-of-string marker $. Make surethe grammar represents the semantic structure of regular expressions. For example, the partialgrammar

E ? char

E ? EE

E ? E|E

would allow us to parse the regular expression “ab|c” to be composed of two regular expressions“a” and “b|c”, which is semantically incorrect. The correct parse is a regular expression composedof two regular expressions “ab” (which in turn is composed of smaller regular expressions) and“c”. Review how we ensured arithmetic expressions are parsed in a way that reflects operatorprecedence to get an idea how you can ensure that the parse tree corresponding to a regularexpression correctly reflects its structure.

(b) Provide the parse tree used to generate the string “.*(1.1|1..1).*” using your grammar.

(c) Verify that your grammar is LL(1). (If it is not, modify the grammar to make it LL(1).) Inparticular, provide FIRST, FOLLOW, and PREDICT sets for characters and productions and explainwhy they prove that the language is LL(1).

d) (Bonus: 25%) Provide the pseudo-code for a recursive descent parser for regular expressionsbased on your grammar.


"Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Eminence Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Eminence Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Eminence Papers are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Eminence Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.