Hey guys, so I'm working on an assignment for school and we are to create a Recursive Descent Parser program. It will take a string and then generate all the substrings of it. I was wondering if someone could help out a bit. I'm having a tough time wrapping my head around the algorithm to get started. Any help would be awesome. I've been googling it and still trying to understand it
Recursive Descent Parser
Page 1 of 111 Replies - 4894 Views - Last Post: 03 March 2012 - 02:36 PM
Replies To: Recursive Descent Parser
#2
Re: Recursive Descent Parser
Posted 02 March 2012 - 05:59 PM
So ? What do you have produce as code so far ?
And which problem(s) do you have with it ?
And which problem(s) do you have with it ?
#3
Re: Recursive Descent Parser
Posted 02 March 2012 - 07:53 PM
Quote
I'm having a tough time wrapping my head around the algorithm to get started. Any help would be awesome. I've been googling it and still trying to understand it
That's because a recursive descent parser doesn't do that. If you want to know about them, check out the section on top-down parsing in my parsing tutorial. RD parsers build abstract representations of the syntactical structure of a string for some language.
Quote
It will take a string and then generate all the substrings of it.
If I have the word "fooba" I might generate all sub strings as follows:
f fo foo foob fooba o oo oob ooba o ob oba b ba
See the pattern? Use a set, and all duplicates will be removed.
This post has been edited by blackcompe: 02 March 2012 - 07:54 PM
#4
Re: Recursive Descent Parser
Posted 02 March 2012 - 10:40 PM
blackcompe, on 02 March 2012 - 07:53 PM, said:
Quote
I'm having a tough time wrapping my head around the algorithm to get started. Any help would be awesome. I've been googling it and still trying to understand it
That's because a recursive descent parser doesn't do that. If you want to know about them, check out the section on top-down parsing in my parsing tutorial. RD parsers build abstract representations of the syntactical structure of a string for some language.
Quote
It will take a string and then generate all the substrings of it.
If I have the word "fooba" I might generate all sub strings as follows:
f fo foo foob fooba o oo oob ooba o ob oba b ba
See the pattern? Use a set, and all duplicates will be removed.
so if that isn't the function of a RDP then what is my teacher trying to get us to do? because all the stuff that I have been reading on a RDP says some weird stuff that i'm just not understanding
#5
Re: Recursive Descent Parser
Posted 03 March 2012 - 07:08 AM
Quote
so if that isn't the function of a RDP then what is my teacher trying to get us to do?
How would I know? Does the assignment have a public URL?
Quote
because all the stuff that I have been reading on a RDP says some weird stuff that i'm just not understanding
What's this weird stuff you're referring too. It's as simple as looking up RD Parsing on Wikipedia. As you can see, it has nothing to do with generating sub-strings and to my knowledge it can't be used to do so.
#6
Re: Recursive Descent Parser
Posted 03 March 2012 - 08:59 AM
this is the assignment pdf just copied everything in
[code]
CSCD211 – Programming Principles II 11/3/2011
Assignment – Recursive Descent Parser 50 points See Blackboard for due date
Implement a class called SubstringGenerator that uses recursion to generate all substrings of a given String. For example, the substrings of the string "Sluggo" are the 22 strings:
Sluggo
Slugg
Slug
Slu
Sl
S
luggo
lugg
lug
lu
l
uggo
ugg
ug
u
ggo
gg
g
go
g
o
""
You are not allowed to use any loops to build the substrings -- at least in your final product. You may, however, find it productive to solve the problem using loops first, and then translate to recursive code.
Implement a class called SubstringTester that is used to interact with the user and allow for testing of the SubstringGenerator class. This class should
Get a string from the user
Generate the substrings of the string
CSCD211 – Programming Principles II 11/3/2011
Display the substrings
Repeat the above three things until the user chooses to quit
Javadoc
Additionally, this assignment requires that you ‘Javadoc’ your source code. That is, your source code must conform to the Javadoc documentation standards. See ‘Course Documents’ for Javadoc examples.
To Turn In
Turn in all source code in a single zip file. Name your zip file as usual. Submit to Blackboard.
Note
You should not have a great deal of code for this assignment -- think about it -- its recursion :-)
[\code]
[code]
CSCD211 – Programming Principles II 11/3/2011
Assignment – Recursive Descent Parser 50 points See Blackboard for due date
Implement a class called SubstringGenerator that uses recursion to generate all substrings of a given String. For example, the substrings of the string "Sluggo" are the 22 strings:
Sluggo
Slugg
Slug
Slu
Sl
S
luggo
lugg
lug
lu
l
uggo
ugg
ug
u
ggo
gg
g
go
g
o
""
You are not allowed to use any loops to build the substrings -- at least in your final product. You may, however, find it productive to solve the problem using loops first, and then translate to recursive code.
Implement a class called SubstringTester that is used to interact with the user and allow for testing of the SubstringGenerator class. This class should
Get a string from the user
Generate the substrings of the string
CSCD211 – Programming Principles II 11/3/2011
Display the substrings
Repeat the above three things until the user chooses to quit
Javadoc
Additionally, this assignment requires that you ‘Javadoc’ your source code. That is, your source code must conform to the Javadoc documentation standards. See ‘Course Documents’ for Javadoc examples.
To Turn In
Turn in all source code in a single zip file. Name your zip file as usual. Submit to Blackboard.
Note
You should not have a great deal of code for this assignment -- think about it -- its recursion :-)
[\code]
#7
Re: Recursive Descent Parser
Posted 03 March 2012 - 09:05 AM
If I'd had to guess the assignment is under the heading "recursive descent parser" because it prepares you for the topic of recursive descent parsing by getting you familiar with recursion. I don't see anything in the actual text of the assignment that suggests you're actually supposed to implement a recursive descent parser.
If I were you, I'd simply ignore the heading and just solve the assignment normally (using recursion).
If I were you, I'd simply ignore the heading and just solve the assignment normally (using recursion).
#8
Re: Recursive Descent Parser
Posted 03 March 2012 - 09:08 AM
Yes, it's just asking you to use recursion to solve the problem. Nothing to do with RDP. You should tell your professor to change that -- it's quite misleading.
#9
Re: Recursive Descent Parser
Posted 03 March 2012 - 09:09 AM
i will suggest that thanks guys! if i have any issues solving it i will definitely come back here for some help
#10
Re: Recursive Descent Parser
Posted 03 March 2012 - 11:27 AM
where in the world is the edit button!
#11
Re: Recursive Descent Parser
Posted 03 March 2012 - 12:21 PM
You won't have access to the edit button until you have a certain amount of posts. Its to prevent new members from removing their code when they have got their answers.
Page 1 of 1

New Topic/Question
Reply


MultiQuote




|