Re: Python parser

Mark Hahn <[email protected]> Sun, 8 Aug 2004 10:58:44 -0700
Newsgroups gmane.comp.lang.prothon.user
Organization Hahn Creative Applications
Message-ID <[email protected]>
On Sat, 07 Aug 2004 20:19:37 -0400, Laurent Dube wrote:

> Hi Mark,
> 
> If the main (only?) reason for switching paths is for having Prothon be
> more immediately connected to usable libraries, there might be a less
> onerous way of doing it than tagging on to .Net right away.
> 
> Just consider your previous approach for a minute. You have a parser
> that reads prothon code and converts it to structures and data your
> interpreter can run.
> 
> How about adding a second parser accepting python code as input, and 
> giving you access at the same time to python libraries? 
> What subset of python could be handled? 
> What if the interpreter had a python mode? 
> Has this been discussed before? 
> Your own multiple-language VM?

It is an interesting concept but I don't think I could make it work.  

When I looked at running CPython's libraries with Prothon earlier this year
it didn't look good.  The Python libraries were too tightly wrapped around
the Python language.  The CPython VM was not written to support multiple
languages as the CLR is.  Python extensions expect to be able to have any
and all of Python available at all times.

The best I could do would be to have the CPython interpreter running
embedded inside my Prothon interpreter and bridging calls from Prothon over
to Python.  This would not be efficient as it would require both VMs to run
side by side.  There would also be the overhead of translating between the
two.  Threads would not be supported.  I pretty much gave up on the idea.