>>>>> I??aki Baz Castillo <[EMAIL PROTECTED]> wrote:

> Hi, I've used a BNF_to_RegExp converter to get all the RFC 3261 BNF code as 
> Ruby RegExp. This could seem nice, but now I'm not sure if I should use these 
> RegExp or not since they are very very long...

For many cases, there is no need to include all grammar for all
levels. E.g., to extract URI from header, very relaxed URI grammar
can be used, as a character class or small expression with
character classes. Later, when parsing URI, you'll use more
detailed expression. The same for another complicated elements.

I've got negative experience with complicated grammar regexps and
NFA regexp engine with exponential growing of matching time (up to
a few days for short URI), so changed to use the simplest
available form to separate into smaller sentenses and then parse
them separately.

> Do other SIP stacks use those RegExp?

No strict need; seems the main approach is to use parser generator
(e.g. yacc), but grammar from RFC shall be tuned. E.g. paragraph
20 which differentiates case of name-addr and addr-spec needs
special reflection in grammar.

-- 
Valentin Nechayev
PortaOne Inc., Software Engineer
mailto:[EMAIL PROTECTED]
_______________________________________________
Sip-implementors mailing list
[email protected]
https://lists.cs.columbia.edu/cucslists/listinfo/sip-implementors

Reply via email to