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: <jeremy@alum.mit.edu>
 <15020.9404.557943.164934@w221.z064000254.bwi-md.dsl.cnc.net>
 <200103120711.AAA09711@localhost.localdomain>
 <15021.22659.616556.298360@anthem.wooz.org>
 <200103122341.SAA23054@cj20424-a.reston1.va.home.com>
Message-ID: <15021.24398.737816.108344@w221.z064000254.bwi-md.dsl.cnc.net>

>>>>> "GvR" == Guido van Rossum <guido@digicool.com> writes:

  >> syntaxes with minimal overhead.  If I understand their work
  >> correctly, they have their own compiler which is built on
  >> Jeremy's tools, and which accepts a modified Python grammar,
  >> generating different but compatible bytecode sequences.  E.g.,
  >> their syntax has a "template" keyword approximately equivalent to
  >> "def" and they do something different with bare strings left on
  >> the stack.

  GvR> I'm not sure this is viable.  I believe Jeremy's compiler
  GvR> package actually doesn't have its own parser -- it uses the
  GvR> parser module (which invokes Python's standard parse) and then
  GvR> transmogrifies the parse tree into something more usable, but
  GvR> it doesn't change the syntax!  Quixote can get away with this
  GvR> because their only change is giving a different meaning to
  GvR> stand-alone string literals.  But for type annotations this
  GvR> doesn't give enough freedom, I expect.

Right!  It would be nice to kill two birds with one stone though.  We
could generate an alternate parser for Python and have it generate the
same AST, decorated with type information.  Even if the type
experiment doesn't work out, the alternate parser might be useful.

Jeremy


From paulp@ActiveState.com  Tue Mar 13 02:00:46 2001
From: paulp@ActiveState.com (Paul Prescod)
Date: Mon, 12 Mar 2001 18:00:46 -0800
Subject: [Compiler-sig] Re: [Python-Dev] Revive the types sig?
References: <jeremy@alum.mit.edu>
 <15020.9404.557943.164934@w221.z064000254.bwi-md.dsl.cnc.net>
 <200103120711.AAA09711@localhost.localdomain>
 <15021.22659.616556.298360@anthem.wooz.org>
 <200103122341.SAA23054@cj20424-a.reston1.va.home.com> <15021.24398.737816.108344@w221.z064000254.bwi-md.dsl.cnc.net>
Message-ID: <3AAD7F4E.6B0A460F@ActiveState.com>

Jeremy Hylton wrote:
> 
>...
> 
> Right!  It would be nice to kill two birds with one stone though.  We
> could generate an alternate parser for Python and have it generate the
> same AST, decorated with type information.  Even if the type
> experiment doesn't work out, the alternate parser might be useful.

I would love to see this for a variety of reasons. I have bandwidth to
generate types-sig patches for a compiler but not to write the compiler
from scratch, though. :( Anyone else interested?

-- 
Python:
    Programming the way
    Guido
    indented it.
       - (originated with Skip Montanaro?)


From biotechinfo2003@yahoo.com  Mon Mar 26 15:33:03 2001
From: biotechinfo2003@yahoo.com (biotechinfo2003@yahoo.com)
Date: Mon, 26 Mar 2001 15:33:03
Subject: [Compiler-sig] FREE Biotech Stock Info!    651
Message-ID: <555.101640.416210@excite.com>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Do you want to capitalize on the Biotech Revolution</title>
</head>

<body>

<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto" align="center"><img border="0" src="http://www.geocities.com/mailtestbox2001/Kiloh_logo.gif" width="204" height="170"></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:Arial">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?</span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:Arial">The
exclusive <b>Ruddy-Carlisle Biotech Infoline</b> 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 <b><u>100% FREE</u></b>! <b><span style="color:blue"><a href="mailto:biotechsubscribe2@yahoo.com">Sign
up!</a></span></b></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><i><span style="font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Arial;color:#003366">Ruddy-Carlisle
Biotech Infoline:</span></i></b></p>
<ul type="disc">
  <li class="MsoNormal" style="color:#003366;mso-margin-top-alt:auto;mso-margin-bottom-alt:
     auto;mso-list:l0 level1 lfo1;tab-stops:list .5in"><b><i><span style="font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Arial">Instantly
    delivers key life sciences investment information directly to you! </span></i></b><o:p>
    </o:p>
  </li>
  <li class="MsoNormal" style="color:#003366;mso-margin-top-alt:auto;mso-margin-bottom-alt:
     auto;mso-list:l0 level1 lfo1;tab-stops:list .5in"><b><i><span style="font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Arial">Learn
    about biotech, pharmaceutical &amp; medical device investment opportunities
    before others! </span></i></b><o:p>
    </o:p>
  </li>
  <li class="MsoNormal" style="color:#003366;mso-margin-top-alt:auto;mso-margin-bottom-alt:
     auto;mso-list:l0 level1 lfo1;tab-stops:list .5in"><b><i><span style="font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Arial">Includes
    IPO &amp; private placement information! </span></i></b><o:p>
    </o:p>
  </li>
  <li class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l0 level1 lfo1;tab-stops:list .5in"><b><i><span style="font-size:
     11.0pt;mso-bidi-font-size:12.0pt;font-family:Arial;color:#003366">100%
    FREE!</span></i></b></li>
</ul>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:Arial">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, <u>over forty</u>
are projected! The genomic promise is about to be delivered and investors know
it. The <b>Ruddy-Carlisle Biotech Infoline </b>provides you with critical,
decision-making, information that aids the chance of investment success in this
lucrative space. <b><span style="color:blue"><a href="mailto:biotechsubscribe2@yahoo.com">Sign
up!</a></span></b></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span style="font-family:Arial">Please
Note-</span></b><span style="font-family:Arial"> Your information will only be
shared with companies that are in the life sciences space <u>and</u> pass our
rigorous inspection. Only the best opportunities will come to you.
Ruddy-Carlisle respects your privacy. <b><span style="color:blue"><a href="mailto:biotechsubscribe2@yahoo.com">Sign
up!</a></span></b></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;</p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;</p>
<b><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial;
mso-fareast-font-family:&quot;Times New Roman&quot;;mso-ansi-language:EN-US;mso-fareast-language:
EN-US;mso-bidi-language:AR-SA">
</p>
</p>List Removal Instructions</span></b><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial;mso-fareast-font-family:
&quot;Times New Roman&quot;;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA">- Simply click here: <b><span style="color:blue"><a href="mailto:remobiotech3@yahoo.com">remove</a></span></b>
to be instantly and permanently removed from our list. Send the blank email to
the address specified. Please do not try to reply to this message.</span>

</body>

</html>