[ale] Complex Parsing
tew at wiencko.com
tew at wiencko.com
Tue Nov 6 15:31:02 EST 2001
lex and yacc. Definitely.
The problem with these little projects is that they have an ugly way of
growing and growing. You can write procedural code to handle simple cases
in C (or perl or python or whatever) easily enough, but then the changes
start to come in. And you have to patch the bandaids on the kluges of
the code.
I have had this problem come up more times in the last 20 years than I can
possibly count, and each time I did not start out right with a state machine
implementation (like lex/yacc) I sooner or later regretted it. Usually sooner.
Start right. Build a little lexer and a basic grammer in yacc. Or use the
few tools out there to do the same thing in some other language (although
lex/yacc or flex/bison are the best documented, most stable, and easiest
to find and use). Then when your changes start rolling in, you have the
framework to handle them gracefully.
Tom
On Thu, 20 September 2001, "Christopher Fowler" wrote:
>
> Help. (Again)
>
> I need to do some complex parsing and need some pointers.
>
>
> Example command line:
>
>
> set user Jose home /home/jose password "cuervo"
>
>
> Basically, Jose is a key to a record.
>
> home is a command that expects the next argument to be location of home
> password is a commadn that expects next argument to be password.
>
> Someone could interchange those two arguments and it could look like this:
>
> set user Jose password "Cuervo" home /home/jose auth admin
>
> Should I uses a scanner? I there some good docs on internet for this kind
> of stuff?
>
> Chris
>
>
> ---
> This message has been sent through the ALE general discussion list.
> See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
> sent to listmaster at ale dot org.
---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.
More information about the Ale
mailing list