Leon Timmermans wrote:
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

Below is the grammar.

I am only interested in tag names <xs1:text> <xs1:playlist> (and within playlist) <xs1:item>
The only attributes I want are 'author', 'title', and 'id'

grammar sony_grammar;
rule TOP {
 ^
 <xmldecl>?
 <root=element>
 $
}

rule xmldecl {
  '<?xml'
  'version'  '=' '"' $<version>=<-[\"]>+ '"'
  'encoding' '=' '"' $<encoding>=<-[\"]>+ '"'
  '?>'
}

rule element {
 '<' <name> <attribute>*
 [
 | '/>'
 | '>' <element>* '</' $<name> '>'
 ]
}

rule attribute { <name> '=' '"' $<value>=<-["]>* '"' }

token name { <namespace>? $<ename>=<ident> }
token namespace { <ident> ':' }


Reply via email to