simple command line environment

"Jeff D. Hamann" <jeff_hamann@hamandonald.com>
11 Dec 2001 21:35:58 -0500

          From comp.compilers

Related articles
simple command line environment jeff_hamann@hamandonald.com (Jeff D. Hamann) (2001-12-11)
Re: simple command line environment ee4299@ee.teiath.gr (Andreou Al.) (2001-12-15)
| List of all articles for this month |
From: "Jeff D. Hamann" <jeff_hamann@hamandonald.com>
Newsgroups: comp.compilers
Date: 11 Dec 2001 21:35:58 -0500
Organization: SCN Research of Tigard, Oregon, USA.
Keywords: parse, question, comment
Posted-Date: 11 Dec 2001 21:35:58 EST

I'm looking into developing a simple command line environment, similar to
R,S-Plus,GRASS,etc, but would like to get past parsing command line
arguments like (argc,argv) for a single command. What is a good model to use
when starting to develop a simple interpreter or command line environment.
I've started browsing the R source code and it seems a bit complex. I need
to start small.


something like...


while( token != "quit" )
{
        process command
        get next command;
}


i know it's pretty rough pseudo-c code, and I can generate a simple parser
for single lines, but I would like to be able to use, from a command line
interface,


model_1 <- load( "organon.lib" ) ; load the model
sample <- load( "organon.txt" ) ; some file format
grow( sample, model_1, 5 ) ; grow sample using model_1 for five years
expf_thin( sample, 0.5 ) ; remove half the trees/acre


while( basal_area( sample ) < 200.0 )
{
        grow( sample, model_1, 1 ) ; grow sample using model_1 for one year
        summary( sample ) ; spit out summary information about the
sample
}


export( sample1, "c:\test_sample.txt" )


now I know this *isn't* trivial, but ya gotta have goals, right? For now,
I'd be happy with


sample s;
read( s, "sample.txt" )
grow( s, 5 )
write( s, "sample_out.txt" )


Thanks,
Jeff.


--
Jeff D. Hamann
Hamann, Donald and Associates
PO Box 1421
Corvallis, Oregon USA 97339-1421
Bus. 541-753-7333
Cell. 541-740-5988
jeff_hamann@hamanndonald.com
www.hamanndonald.com
[Why not use one of the many freely available scripting languanges that
already exist? -John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.