From: Thomas Demmer Newsgroups: comp.os.msdos.djgpp Subject: Re: Command Parser Date: Fri, 04 Apr 1997 10:19:56 +0100 Organization: Lehrstuhl fuer Stroemungsmechanik Lines: 43 Message-ID: <3344C7BC.41C6@LSTM.Ruhr-UNI-Bochum.De> References: <01bc409f$afbb59c0$97c3b8cd AT scully> NNTP-Posting-Host: bvb.lstm.ruhr-uni-bochum.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Cephaler wrote: [...] > > Prog output: Enter a command: _ > User Input: /showfilestats math.c > > then, after that, the program parses the user input and puts it into char > *UserCommand[10] like this: > > UserCommand[0] = /showfilestats > UserCommand[1] = math.c > > Then, I can figure the rest out myself :) But as of now, I have no idea how > to do something like that, I have never programmed a command-driven > program. Hmm, if it's possible, could you please mail me some sample code? > I'm an extremely fast visual learner, and I check my mail more often that > news. Thanks in advance flex & bison are exactly what you're looking for. You can find the djgpp ports under v2gnu on your local simtel mirror. You'll just have to set up a bunch of rules what a keyword is, what an identifier, number etc, is. And then of course a set of rules telling the parser that after showfilestats _must_ follow a file/path. It'll even yell "syntax error" when the user breaks the rules ;-) -- Ciao Tom ************************************************************* * Thomas Demmer * * Lehrstuhl fuer Stroemungsmechanik * * Ruhr-Uni-Bochum * * Universitaetsstr. 150 * * D-44780 Bochum * * Tel: +49 234 700 6434 * * Fax: +49 234 709 4162 * * http://www.lstm.ruhr-uni-bochum.de/~demmer * *************************************************************