in reply to
C vs perl
Well, that is some aggresively ugly C code. If one objective of you presentation is to convince competent C coders to try Perl then I suggest you take another run at it. With that code the first thing they'll think is that you just don't know enough C to know how much it rocks.
- Do it in one pass. No one likes to see an alogorithm that has to scan through the input text more than once. That might mean realloc()ing memory as you run short, but you should be able to take a good guess based on the input text length.
- Consider making use of the str*() library routines. Perl has much better string support but it's not as though C is totally lacking!
- Think about building your parser around as swicth-driven state-machine. This is how C parsers are commonly built.
- Maybe do it with YACC instead? No one should build parsers in C by hand once they learn YACC! I bet the YACC implementation would compare favorably with Perl.