Re: Re: Python parser
Lenard Lindstrom <[email protected]> Sun, 8 Aug 2004 19:24:37 -0700 (Pacific Daylight Time)
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <Mahogany-0.66.0-4294649657-20040808-193042.00@pop3.norton.antivirus> |
On Sun, 8 Aug 2004 10:58:44 -0700 Mark Hahn <[email protected]> wrote: > 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. > Just some speculation. Does not the Stackless Python interpreter come close to the CProthon implementation? Add some extra byte code instructions to handle Prothon's distinct scoping rules and implement prototypes using PyType_Type. Could object locking be done by the object itself? All attribute accesses would be through a special attribute handler method. And Prothon's one pass compiler could still be used. So now you have a virtual machine that handles both languages, no dual interpreters. Lenard Lindstrom <[email protected]>