By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,646 Members | 1,444 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,646 IT Pros & Developers. It's quick & easy.

java parser

P: 2
Hello everybody :)
I've got a question. I want to know how can I write a parser
"There is a table(dimension: 3 in 4 in 5 meters) in the room"
in a way that the output would be this:
Type: table
Numbers: 1
Size: 60 M^3
Position: Room

I tried substring and split method, but I didn't get the result that I wanted. Could you please help me with this? :( What are the useful methods with which I can write this code?
Oct 21 '13 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 785
Use regular expression.

But the better way: define an EBNF-like grammar and then use some ready-made method that converts them into a tree of tokens.
Look in Wikipedia, "Recursive descent parser" for an example.
Oct 21 '13 #2

P: 2
Thank you So much :) I read the wikipedia page. It might be a good idea but I want a simpler and shorter way. again thanks :)
Oct 21 '13 #3

Post your reply

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