| Author |
Efficient parsing algorithm for String Parsing
|
akhil achuthan
Ranch Hand
Joined: Mar 29, 2006
Posts: 69
|
|
Please let me know any efficient parsing generator for String parsing.
Be specific the following are my requirements - the issues that i expect the parser to tackle
* The strings that is to be parsed will be too big, may be in thousands of lines.
* My parsing should check for the grammer syntax and get me the values. For eg my String will be something like "IPADDR:198.187.90.99,MAC:321612aaff21". The parser should get the value for ip as 198.187.90.99 and mac as 321612aaff21.
I tried javacc, but the limitation is that i do not want my grammer to be something static.. i mean i expect something like the whenever there is a change in the grammer, I need not write the jj file from scratch, instead i can just define the structure somewhere and the rest will be taken care by my parser... I dont think javacc supports such behaviour...
Please help
Thanks
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32638
|
|
akhil achuthan wrote:i mean i expect something like the whenever there is a change in the grammer, I need not write the jj file from scratch, instead i can just define the structure somewhere and the rest will be taken care by my parser... I dont think javacc supports such behaviour...
Do any parsers support such behaviour?
But what you quote doesn't use a context-free grammar which requires parsing. "IPADDR:198.187.90.99,MAC:321612aaff21" look to me like something out of a regular grammar. Can you think up a regular expression or a set of regular expressions which will split your String? You could pass in a String for a regular expression from the command line if you need to alter it each time.
|
 |
akhil achuthan
Ranch Hand
Joined: Mar 29, 2006
Posts: 69
|
|
I do not need to change the grammer at run time.. Only in case if the grammer is getting modified at some stage... I just wanted to keep my grammer as configurable and rather than being hard coded...
I can write code bits to pass this grammer to my parser, but in javacc, the .jj file in which we define the grammer is a non executable one. So there is no option by which i can pass any grammer into it.... Once the .jj is compiled, it creates the java file can be modified, but i do not want to disturb a tool created piece of code.....
|
 |
akhil achuthan
Ranch Hand
Joined: Mar 29, 2006
Posts: 69
|
|
|
The grammer of the string that i need to parse will vary depending on my request that i issue to my target. So im in need of having one parser for each type of target request.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32638
|
|
|
Do you really need a posh parser like javacc or CUP at all? I suspect you only would if the strings are more complicated than what you have already quoted.
|
 |
akhil achuthan
Ranch Hand
Joined: Mar 29, 2006
Posts: 69
|
|
That was just a sample string that i had given over there.
The string that i get as response for my request will have thousands of lines, each line having a bare minimum of 30+ key value pair like IPADDR:....
I cannot rely on a normal string parsing as it takes a very long time to parse....
|
 |
 |
|
|
subject: Efficient parsing algorithm for String Parsing
|
|
|