Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 3 (20 points) Convert the following inductive definition for regular expressions into a grammar first and then into a set of scala classes A

image text in transcribedimage text in transcribed

Problem 3 (20 points) Convert the following inductive definition for regular expressions into a grammar first and then into a set of scala classes A regular expression is defined inductively as follows: Any string s is an "atomic" regular expression The concatenation rr2. The disjunction rilr2, and The conjunction ri&r2. If r is a regular expression, then its Kleene starr is also a regular expression Use the constructor symbols Atom(s) to denote an atomic regular expression, Concat(ri, r2) for the " operator, Or(ri. r2 for the "" operator, And(ri, r2) for the "&" operator and Star(r) for the Kleene-star operator. You may use the nonterminal string without definition to denote a string of characters. A (7 point) Write the grammar using constructor symbols for the inductive definition above. Tip: you can examine the notebooks with inductive definitions to see how we typeset the grammar. There are no tests for this because it will be manualy graded. YOUR ANSWER HERE B (7 points) Define the structure as a set of case class in scala. Problem 3 (20 points) Convert the following inductive definition for regular expressions into a grammar first and then into a set of scala classes A regular expression is defined inductively as follows: Any string s is an "atomic" regular expression The concatenation rr2. The disjunction rilr2, and The conjunction ri&r2. If r is a regular expression, then its Kleene starr is also a regular expression Use the constructor symbols Atom(s) to denote an atomic regular expression, Concat(ri, r2) for the " operator, Or(ri. r2 for the "" operator, And(ri, r2) for the "&" operator and Star(r) for the Kleene-star operator. You may use the nonterminal string without definition to denote a string of characters. A (7 point) Write the grammar using constructor symbols for the inductive definition above. Tip: you can examine the notebooks with inductive definitions to see how we typeset the grammar. There are no tests for this because it will be manualy graded. YOUR ANSWER HERE B (7 points) Define the structure as a set of case class in scala

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

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions