| | |
Homework help that isn't really homework help
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2008
Posts: 9
Reputation:
Solved Threads: 0
So I was going through the course archives for our CS program and looked at some notes and quizzes from a class that was last taught in Spring of 2008 that I will be taking Fall of 2009. It's called Survey of Programming Languages and I found the section on grammar to be interesting.
Here are the questions I'm referencing:
# Consider the regular expression a((ab)*|(ba)*)b.
1. Which one of the following strings is not accepted by this regular expression?
* ab
* aababb
* ababb
* abababab
2. Which one of the following strings is accepted by this regular expression?
* bababb
* aababb
* aabababa
* abaabb
# Consider this grammar in BNF.
<S> -> a<B> | b<A>
<A> -> a | a<S> | b<A><A>
<B> -> b | b<S> | a<B><B>
Show that the string baab is in the language by providing a derivation.
Consider the following grammar:
<S> --> <A>
<A> --> <A> + <A> | <id>
<id> --> a | b | c
Give an example of an ambiguous sentence in this language.
Give an example of something that is bound at language design time.
Give an example of something that is bound at language implementation time.
Give an example of something that is bound at compile time.
Give an example of something that is bound at load time.
Give an example of something that is bound at run time.
I suppose I'm lost because whoever that professor was didn't upload the presentations (forcing students to come to class), but if you guys know what this stuff means and can point me in the right direction I'd really appreciate it!
Here are the questions I'm referencing:
# Consider the regular expression a((ab)*|(ba)*)b.
1. Which one of the following strings is not accepted by this regular expression?
* ab
* aababb
* ababb
* abababab
2. Which one of the following strings is accepted by this regular expression?
* bababb
* aababb
* aabababa
* abaabb
# Consider this grammar in BNF.
<S> -> a<B> | b<A>
<A> -> a | a<S> | b<A><A>
<B> -> b | b<S> | a<B><B>
Show that the string baab is in the language by providing a derivation.
Consider the following grammar:
<S> --> <A>
<A> --> <A> + <A> | <id>
<id> --> a | b | c
Give an example of an ambiguous sentence in this language.
Give an example of something that is bound at language design time.
Give an example of something that is bound at language implementation time.
Give an example of something that is bound at compile time.
Give an example of something that is bound at load time.
Give an example of something that is bound at run time.
I suppose I'm lost because whoever that professor was didn't upload the presentations (forcing students to come to class), but if you guys know what this stuff means and can point me in the right direction I'd really appreciate it!
•
•
Join Date: Jun 2008
Posts: 51
Reputation:
Solved Threads: 5
•
•
•
•
So I was going through the course archives for our CS program and looked at some notes and quizzes from a class that was last taught in Spring of 2008 that I will be taking Fall of 2009. It's called Survey of Programming Languages and I found the section on grammar to be interesting.
Here are the questions I'm referencing:
# Consider the regular expression a((ab)*|(ba)*)b.
1. Which one of the following strings is not accepted by this regular expression?
* ab
* aababb
* ababb
* abababab
2. Which one of the following strings is accepted by this regular expression?
* bababb
* aababb
* aabababa
* abaabb
Basically the regex can be broken down as such
1. look for an a
2. now look for either none or more ba,
OR
none or more ab
(But not both)
3. look for a b at the end.
Thus the first question #1 would fail on this line : ababb
because you have ababb and since there is no a after the second b it fails a "change" that would make this work would be:
ababab
For question #2 can you apply the same concept as the steps above and determine which will fail
(should be pretty easy to cut it down to 2 and from there just look closely)
Good luck and as far as the rest of your question I have no clue...sorry.
My Blog:
Onablog
Onablog
![]() |
Similar Threads
- We only give homework help to those who show effort (Computer Science)
- HELP ME MY MISTAKE and HELP THE CORRECT The my homework (C++)
- school task help (Java)
- Fibonacci Number (Assembly)
- continuous string (C)
- Slightly complex... (VB.NET)
- Inheritance (C)
- Need help with database linking! (VB.NET)
- need help to create a java program (Java)
Other Threads in the Java Forum
- Previous Thread: Spilt text and parse to arraylist
- Next Thread: Question about jDateChooser.. Help please :)
| Thread Tools | Search this Thread |
Tag cloud for Java
affinetransform android api append apple applet application arguments array arrays automation bi binary bluetooth businessintelligence busy_handler(null) chat class classes client code component database draw eclipse encryption equation error event exception file fractal game givemetehcodez graphics gui helpwithhomework html ide image input integer intersect j2me java javaexcel javaprojects jmf jni jpanel julia linked linux list loop main map method methods mobile netbeans newbie number open-source oracle oriented panel print problem program programming project qt recursion reference replaysolutions repositories return robot scanner screen scrollbar se server set singleton size sms socket sort sql string swing test threads time tree utility windows xor





