[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Context free grammar

Posted on 2011-02-23
2
Medium Priority
?
340 Views
Last Modified: 2012-05-11
Hello experts,
How I will translate a regular expression which contains a group of characters to cfg?
For example if I have this regular expression:
[wx]*ocl(qw|zx)*
how I will translate this?
And also how I will define a cfg which will  not let me define this regular expression using bracketing?
0
Comment
Question by:puffyy_beginner
  • 2
2 Comments
 
LVL 13

Accepted Solution

by:
Superdave earned 2000 total points
ID: 34962101
1.  Could you clarify whether this is your homework?
2.  I don't understand the second question.  Are you asking for a CFG that is not an RE?
0
 
LVL 13

Expert Comment

by:Superdave
ID: 34962159
Anyway, you can use "recursion" in a production to make something repeat:

wx ::= "w"|"x"
wxstar := "" | (wx wxstar)
 

If I guessed right about what your second question meant, having a language with the rule that you have the same number of a repeating character in two places is a typical example of a CFG that is not regular.  I'll let you work out the grammar for it until I find out about my first question.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
Simple Linear Regression
Screencast - Getting to Know the Pipeline
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question