473,385 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to define a Grammar for a Language

Steel546
The question I'm working on has to do with defining a grammar set for a language. There is no defined set to use, it just needs to be made up.

The language is { a*b^n*c | n = 0, 1, 2, 3...}.

I understand I need the start symbol S, with vocabulary of non-terminals and terminals. I just don't understand how to get down to the a*b^n*c part. Any help understanding this would be appreciated. :)
May 12 '10 #1
1 1236
What you're listing looks just like the core idea for the pumping lemma from automata theory, except they use uvw instead of abc, and uvw can be sequences of any length.

Can you provide more detail? I'm not sure what you're really trying to do.

In addition to more description, can you provide some examples of what's in the language. I think it may be:

ac
abc
abbc
abbbc
abb...bbc

If that's the case, then you don't need a grammar to define this. You only need a regular expression, which is kind of what you have already, or a finite automaton to declare it.

NOTE: Regular expressions are proper subsets of BNF grammers. That is, you can always define a BNF grammar that satisfies a regular expression, but you can't reverse it the other way. Is that the crux of what you're trying to do?
May 14 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

33
by: Quest Master | last post by:
I am interested in developing an application where the user has an ample amount of power to customize the application to their needs, and I feel this would best be accomplished if a scripting...
70
by: KingIshu | last post by:
Hi All, I am developing an object oriented OS code-named "ikbocs". 1) What are the pros and cons of the following languages interms of Effectiveness on System Programming, Object Orientedness etc...
8
by: Hermawih | last post by:
Hello , I want your opinion about this . In order to say it clearly , I think I have to describe it in long sentences . I could consider myself as Intermediate/Advance Access Developer ;...
2
by: Peter Rilling | last post by:
I am written a program that will be used to parse the lexical syntax of code files. I would like to generalize the grammar logic so that I don't hardcode any specific grammar in my program. ...
6
by: james | last post by:
Here is an interesting article from WinInfo that I thought folks here might like to comment on. james Just What We Need--Another Programming Language I hope you've have mastered C# because...
3
by: mcse4u | last post by:
I would like to be able to add a hyperlink to the posted form below that automatically creates a hyperlink of the email address of the person submitting the form. Can someone please help me with...
10
by: verukins | last post by:
Hi, Im a sysadmin/consultant around the microsoft suite of server products and do quite a bit of vbscripting to manipulate AD/Exchange. I'd like to start doing a little more, specifically...
10
by: Immortalist | last post by:
Various aquisition devices that guide learning along particular pathways towards human biases. And as E.O. Wilson might say mental development appears to be genetically constrained. (1) Language...
4
by: skotl | last post by:
Hi all, I'm writing an application that will allow users to specify their own rules to match against certain patterns. Initially I figured that I would offer my own interpreter (byte == 7 &&...
5
by: inungh | last post by:
I need select a language when I create the ASP.NET. It seems that one web page I can only use one language. Am I rgiht? I just wonder the select list only VB and C#. Does ASP.NET support any...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.