in reply to Help Creating a Code Filter
This is non-trivial with regular expressions, as there's too much statefulness to handle. If you really want to pursue this path, you probably have to use regexes to find individual potential tokens and write your own state machine to handle transitions and backtracking. Once you've done that, you've basically written your own grammar engine.
I recommend the use of a grammar, whether Parse::RecDecent for Perl 5 or perhaps Parrot's PGE/PCT combination. The latter has an implementation of C99 in progress in languages/c99/ that might be instructive.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help Creating a Code Filter
by educated_foo (Vicar) on Feb 25, 2008 at 03:40 UTC |