Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Context free grammar

Posted on 2011-02-23
2
Medium Priority
?
339 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Make the most of your online learning experience.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Introduction to Processes
Suggested Courses

636 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