for in D versus C and C++

Georg Wrede georg.wrede at iki.fi
Sat Mar 21 10:03:57 PDT 2009


Sean Kelly wrote:
> == Quote from Walter Bright (newshound1 at digitalmars.com)'s article
>> Sean Kelly wrote:
>>> Sounds like HTTP/HTML.  The best I've come up with so far for parsing
>>> that stuff is to have the lexer actually return tokens representing whitespace
>>> in some instances.  It's totally ridiculous.
>> When you see ad-hoc designs like that, it's obvious the designer has no
>> experience with compilers. It's why every programmer should take a basic
>> course in compiler design <g>.
> 
> I very much agree.  In fact, I'd go so far as to say that my compiler design
> course was the single most valuable CS course I took while in college.  It's
> amazing how many problems I encounter have something to do with parsing
> or language translation.  It's also amazing how many crappy parsers there
> are out there for these same tasks.  Clearly, compiler design doesn't get
> as much attention as it should in undergrad CS.

Sometimes I need to have a command line UI in a program. Such programs 
usually have 5 to 10 commands, with their parameters. One command per line.

So far I have tested and split the command line with regular 
expressions, because using a parser generator has felt like shooting 
mosquitos with a shotgun.

What would your strategy be?



More information about the Digitalmars-d mailing list