Re: slowness in grammar

2009-06-04 Thread Leon Timmermans
If you want to write a fast parser for XML, preventing backtracking is
going to be quite essential. I suspect the problem is your grammar,
not the grammar engine itself. You could post it to perl6-users and
ask for advice on it.

Leon

On Thu, Jun 4, 2009 at 7:25 AM, Richard Hainsworth rich...@rusrating.ru wrote:
 Is this a good place to come with code that runs into speed problems?

 I am writing a program in perl6 to read the xml file from a Sony book
 reader, list the books, and move books into collections (the Sony software
 to do this will only work on windoz and not on wine).

 I have a grammar that works with abbreviated test versions of the xml file,
 but it just hangs with the full version.

 Since I have a line
 my $parsed= sony_grammar(slurp media.xml);

 and the problem is in the parsing, I dont know how to insert trace
 statements to determine at what stage the problem is being generated.

 In addition, there is a great deal in the Synopses about code points and
 backtracking and the like, which I dont quite understand. However, it seems
 to me that an intelligent use of these possibilities could increase the
 efficiency of the parsing, if only I knew how. For example, only three of
 the tags in the file are of interest, and within them three of the
 attributes. So how do I tell the regex engine to skip processing if the tag
 is not of interest?

 Richard



slowness in grammar

2009-06-03 Thread Richard Hainsworth

Is this a good place to come with code that runs into speed problems?

I am writing a program in perl6 to read the xml file from a Sony book 
reader, list the books, and move books into collections (the Sony 
software to do this will only work on windoz and not on wine).


I have a grammar that works with abbreviated test versions of the xml 
file, but it just hangs with the full version.


Since I have a line
my $parsed= sony_grammar(slurp media.xml);

and the problem is in the parsing, I dont know how to insert trace 
statements to determine at what stage the problem is being generated.


In addition, there is a great deal in the Synopses about code points and 
backtracking and the like, which I dont quite understand. However, it 
seems to me that an intelligent use of these possibilities could 
increase the efficiency of the parsing, if only I knew how. For example, 
only three of the tags in the file are of interest, and within them 
three of the attributes. So how do I tell the regex engine to skip 
processing if the tag is not of interest?


Richard