From pchung@watercove.com Fri Mar 9 23:12:27 2001
From: pchung@watercove.com (Peter Chung)
Date: Fri, 9 Mar 2001 18:12:27 -0500
Subject: [Compiler-sig] command line interface parser
Message-ID: <5BFDB1D553A1D411A48200508BB0F6EC02B3CA@k2.watercove.com>
Hi,
I am new to this mailing list, so please excuse my ignorance. I learn about
Python from a colleague. He says I could use it to build a flexible CLI
parser in a grammar I specified easily with Python and have 'C' code
generated for it for Solaris.
Has anyone done a CLI with Python ? If so, is there a reference
implementation available ?
Thanks in advance,
Peter
From loewis@informatik.hu-berlin.de Sat Mar 10 11:25:53 2001
From: loewis@informatik.hu-berlin.de (Martin von Loewis)
Date: Sat, 10 Mar 2001 12:25:53 +0100 (MET)
Subject: [Compiler-sig] command line interface parser
In-Reply-To: <5BFDB1D553A1D411A48200508BB0F6EC02B3CA@k2.watercove.com>
(message from Peter Chung on Fri, 9 Mar 2001 18:12:27 -0500)
References: <5BFDB1D553A1D411A48200508BB0F6EC02B3CA@k2.watercove.com>
Message-ID: <200103101125.MAA27321@pandora.informatik.hu-berlin.de>
> I am new to this mailing list, so please excuse my ignorance. I learn about
> Python from a colleague. He says I could use it to build a flexible CLI
> parser in a grammar I specified easily with Python and have 'C' code
> generated for it for Solaris.
>
> Has anyone done a CLI with Python ? If so, is there a reference
> implementation available ?
Not sure what kind of "command line interface" you are asking for. Do
you want to process a program's argument list (sys.argv), or do you
want to offer an interactive mode for your application?
Depending on the complexity of your language, different approaches
might be appropriate. If the language can be described in terms of
regular expressions, it is probably easiest to use the re module for
the processing. If the language is slightly more complicated, you
could try a few of the Python parser generators (they all generate
Python). I personally found Yapps to be useful for a not-so-small
language; John Aycock presented a "little languages framework" some
years ago.
As for generating C: well, probably not what you've expected. You can
certainly embed Python into your application; that is quite easy to
do. You can also "freeze" the Python modules you use, which involves
generating C code. However, that C code is only large arrays
representing bytecode; you'd still need to link the Python interpreter
into your application.
For providing interactive interfaces, it might be even easier to
decide that the command line language *is* Python. You then only need
to add a few predefined functions that are useful in your application
area (or interface with your software), and you got your CLI. Look Ma,
no compiler.
Regards,
Martin
From jeremy@alum.mit.edu Mon Mar 12 23:44:14 2001
From: jeremy@alum.mit.edu (Jeremy Hylton)
Date: Mon, 12 Mar 2001 18:44:14 -0500 (EST)
Subject: [Compiler-sig] Re: [Python-Dev] Revive the types sig?
In-Reply-To: <200103122341.SAA23054@cj20424-a.reston1.va.home.com>
References: Do
you want to capitalize on the Biotech Revolution? Would you like to add
groundbreaking biotech, pharmaceutical and medical device companies to your
portfolio mix? Does hearing about exciting IPO and private placement offerings
from life sciences companies interest you? The
exclusive Ruddy-Carlisle Biotech Infoline service keeps you abreast of
investment opportunities in the life sciences space. Just sign up for it once
and get important information instantly delivered to study at your leisure. Our
service is 100% FREE! Sign
up! Ruddy-Carlisle
Biotech Infoline: For
the entire last decade there were only three profitable biotech companies. At
the end of this year, ten are projected. At the end of 2003, over forty
are projected! The genomic promise is about to be delivered and investors know
it. The Ruddy-Carlisle Biotech Infoline provides you with critical,
decision-making, information that aids the chance of investment success in this
lucrative space. Sign
up! Please
Note- Your information will only be
shared with companies that are in the life sciences space and pass our
rigorous inspection. Only the best opportunities will come to you.
Ruddy-Carlisle respects your privacy. Sign
up!