"Iñaki Baz Castillo" <[EMAIL PROTECTED]> asks:

> 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 example:
>
> SIP-URI as RegExp is:
<snip>
>
> and Request-Line is 3 times longer that the above RegExp !!!
>
>
> So if my SIP stack runs as UAS, should I really match the incoming request
> line/SIP-URI against those long RegExp? I think it would eat lots of CPU
> resources.
>
> Do other SIP stacks use those RegExp?
>
> In fact, even if I use those RegExp they are just valid to match but not
to
> extract the parts (user, host, port...) since I can't know how many ( )
are
> inside the the regular expression (to get the fragment matches with $1,
$2,
> $3...) so really I'm not sure if those RegExp are useful or not in my
case.

I think the first principle should be "does it work?", and following
closely, "can I maintain it?" For me, the answer to both would be "no", but
your mileage may vary!

I had to write a recursive descent parser, but if I had to write another
stack, I would try hard to find a parser generator.

I think you mentioned that you're writing this in Ruby? In which case Google
tells me you could look into Coco/R or RAA (ruby-yacc) or Racc (Ruby yACC).

frank

_______________________________________________
Sip-implementors mailing list
[email protected]
https://lists.cs.columbia.edu/cucslists/listinfo/sip-implementors

Reply via email to