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.
Specific comments:
- 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.
-sam
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: C vs perl
by abstracts (Hermit) on Apr 28, 2002 at 08:06 UTC | |
by samtregar (Abbot) on Apr 28, 2002 at 19:04 UTC | |
by abstracts (Hermit) on Apr 29, 2002 at 02:09 UTC | |
by samtregar (Abbot) on Apr 29, 2002 at 03:22 UTC | |
Re: Re: C vs perl
by John M. Dlugosz (Monsignor) on Apr 29, 2002 at 15:42 UTC |
In Section
Seekers of Perl Wisdom