Mailing List Archive

1 2  View All
RFC: Viper: yet another python implementation [ In reply to ]
On 15 Aug 1999 23:05:29 GMT, m.faassen@vet.uu.nl (Martijn Faassen) wrote:

>John (Max) Skaller <skaller@maxtal.com.au> wrote:

>I'm sure type inference can be done (at least in a limited fashion), but
>it would be nice to have an intermediate dropoff point; a viperi or
>viperc that would work with type annotations.

It is always possible to 'do' type inference; this
isn't an issue. The issue is whether I can construct an algorithm
that gives useful (and correct) information, and whether I can
then use that information to optimise performance.

Type annotations are planned; the syntax will
probably be:

def f(x:int): pass

because (a) that is fairly standard in other languages, and
(b) it is probably the syntax Guido will adopt. However,
a more transparent scheme is possible (traits a la Swallow; nice idea)

>This is useable already,
>especially if it could be used to create fast Python extension modules.
>(something you aren't aiming for right now, I gather)

I will look at doing this, but it is unclear if enough
benefits can be obtained: Python is highly polymorphic.

>If the project has usuable results at many stages, you have a bigger chance
>to get the 'open source' effect going (if you're aiming for that), too.

That is true, but see above. I need to get
much faster performance for interscript, and it isn't
clear the a module compiler can do that. But I will
definitely look at the idea, although the output
would have to be either C/1.5.2 or Java (Jpython).

>Ah, so the reason you don't use Python itself as the interpreter is
>learning, and also as an intermediate dropoff point.

Not really: C isn't suitable for writing complex
software. I would be mad to use something as low level
as C for programming a compiler/interpreter where
speed is far less important than the speed of the
code which is output. Especially while prototyping.

Secondly, it is easier to extend my own
code than the existing Python code.

>> It is possible the first back end will actually general Ocaml
>> rather than C (since Viper is currently implemented in ocaml).
>
>Hm, why Ocaml?

First, it is a powerful language, and is especially
good for implementing language translators.

Secondly, it can generate assembler output,
so the results are on par with C, sometimes even faster.

Third, it is based on mathematical foundations.

it contains many of the best features of
functional, procedural, and object oriented code,
reasonably well integrated, and again _founded_
on mathematics.

Finally, it is readily available and has a small
footprint.

To put it in a nutshell, it is easily
the best statically typed programming language
I have seen: and the margin is massive.

>I don't know this language, though I heard some
>interesting things about it. But it begs the question why you're
>not using Python itself.

Are you kidding? You really cannot be serious.
Python doesn't have the kinds of constructions needed
for complex software design. Perhaps, after I'm finished
with Viper, it will provide better facilities: one of the aims
is to provide powerful constructions in a unified manner,
but using the nice Python syntax.

>but as you are aiming for a Python compiler
>this can't last. :) And I'd definitely consider at least a C
>backend for the compiler, because C is so common.

I am considering the following backends:

1) Python
2) C
3) C++
4) Assembler (via ocaml)
5) Ocaml

>But Python's C interface is well known and I believe also quite stable;

No, there was an upgrade from 1.5.1 to 1.5.2,
1.6 may be different, 2.0 will certainly be different.

>I can see where you're coming from, but I'd still seriously consider
>adding at least a CPython interface early on -- the more stages in your
>project that are usable, the higher the chance is your project will
>bear fruit.

A CPython interface is indeed possible,
but it will be a very _difficult_ problem. The reason
is the the Viper architecture is quite different to
the CPython 1. For a start, there is a built in
garbage collector. All the objects are represented
differently. The binding will be _much_ harder
than a completely fresh implementation.

Note that JPython doesn't support C modules either.

>I can see where full program analysis may help with type inference,
>of course. But if you go by the intermediate route of manual adding of
>types, it doesn't sound that hard to support some interface with Python.

True. But that won't work for existing code: I want to
be able to compile _existing_ Python sources.

>Of course you need to restrict the modules that can be called by Viper
>code to the set of modules supported by Viper;

Yes. So I have to implement all the common library
modules that do not have a Python .py equivalent.
Note that even 'string' has Python source, and,
surprisingly, almost all of Tkinter is pure python.

>Hm, reading this it seems you're talking about the other thing; supporting
>C Python modules in Viper? I was talking about allowing people to Viper-compile
>their Python modules (as long as they are Viper compliant), and use them
>from Python. But as you say, you can use Pure Python modules in Viper
>as well; if they restrict themselves to the Viper subset.

It would be nice to be able to generate compatible
C modules, since that would allow incremental speed up of
existing python programs.

However, several competent people have tried this
and the results ar barely better than the bytecode interpreter.

OTOH experiments in JPython indicate up to 10000X
faster performance after whole program analysis (so I read,
and I believe it).

John Max Skaller ph:61-2-96600850
mailto:skaller@maxtal.com.au 10/1 Toxteth Rd
http://www.maxtal.com.au/~skaller Glebe 2037 NSW AUSTRALIA
RFC: Viper: yet another python implementation [ In reply to ]
On Sun, 15 Aug 1999 23:54:00 GMT, wtanksle@dolphin.openprojects.net (William Tanksley) wrote:


>Best of all, Pop-11 is finally free.

URL?

>>Hm, why Ocaml?

>ML does type inferance. He's probably using that just so he gets the
>inference free.

I thought of that, but it probably won't work, at least
not completely; I will be implementing a Python specific
inference engine.
John Max Skaller ph:61-2-96600850
mailto:skaller@maxtal.com.au 10/1 Toxteth Rd
http://www.maxtal.com.au/~skaller Glebe 2037 NSW AUSTRALIA
RFC: Viper: yet another python implementation [ In reply to ]
On 20 Aug 1999 00:40:04 GMT, neelk@brick.cswv.com (Neel Krishnaswami) wrote:


> Cecil is a dynamic OO language
>that Craig Chambers has been using to work out techniques for wringing
>speed out of dynamic languages. The only danger is that it will
>inspire John to add predicate methods to Python. :)

Hm, I have enough ideas already for things to add :-)

John Max Skaller ph:61-2-96600850
mailto:skaller@maxtal.com.au 10/1 Toxteth Rd
http://www.maxtal.com.au/~skaller Glebe 2037 NSW AUSTRALIA
RFC: Viper: yet another python implementation [ In reply to ]
On Fri, 20 Aug 1999 22:47:42 GMT, John (Max) Skaller wrote:
>On Sun, 15 Aug 1999 23:54:00 GMT, wtanksle@dolphin.openprojects.net (William Tanksley) wrote:

>>Best of all, Pop-11 is finally free.

> URL?

Er... I don't know. www.google.com... Okay, here's an intro and
overview of some of the applications:
http://www.cogs.susx.ac.uk/users/adrianh/poplog.html; it neglects to
mention the recent open source release (the company shifted to other
things, so the license is XFree-like rather than GPL).
ftp://ftp.cs.bham.ac.uk/pub/dist/poplog/freepoplog.html (took me
forever to find it) has the full info on the latest free versions.

The announcement post is at deja.com; search for "poplog GPL".

>John Max Skaller ph:61-2-96600850

--
-William "Billy" Tanksley
RFC: Viper: yet another python implementation [ In reply to ]
In article <37b075ae.2367293988@news.triode.net.au>, skaller@maxtal.com.au
wrote:

> This is a request for comments on Viper, Yet Another implementation
> of Python. I'm building Viperi, the interpreter, and I'm interested in
> comments on three issues:
>
> 1) compatability with Python
> 2) Extensions
> 3) Optimisation
>
> Viperi is being built as a prelude to implementation of an optimising
> compiler, Viperc. Unlike previous attempts at a compiler, Viperc will do
> type inference, inlining, and special case analysis,
> in an attempt to optimise generated code.


The discussion of Viperi and Viperc is interesting.

I would like to know if there are any url available for the rest of us to get
more information regarding either or both of viperi and viperc?

Thanks in advance.


Sincerely,
Bob
hardwork@freemail.c3.hu


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
RFC: Viper: yet another python implementation [ In reply to ]
On Fri, 20 Aug 1999 22:43:30 GMT, John (Max) Skaller <skaller@maxtal.com.au>
wrote:
>On 15 Aug 1999 23:05:29 GMT, m.faassen@vet.uu.nl (Martijn Faassen) wrote:
>
>>John (Max) Skaller <skaller@maxtal.com.au> wrote:
>
>>I'm sure type inference can be done (at least in a limited fashion), but
>>it would be nice to have an intermediate dropoff point; a viperi or
>>viperc that would work with type annotations.

This is sort of of off-topic, but I'm just making sure that you're aware of
Dylan. Dylan is (to me) philosophically very similar to python, but designed
from the ground up to support type declarations, etc., so it can be a
high-performance compiled language. There have been many suggestions for a
high-performance version of python, much as I love python's syntax, it might
be less hairy and cleaner to just help out the gwydion people (harlequin has a
high-performance dylan compiler written in dylan, but it's not free).

Not python but at least a sibling or cousin or something.
RFC: Viper: yet another python implementation [ In reply to ]
John (Max) Skaller writes:
[regarding the C interface:]
> No, there was an upgrade from 1.5.1 to 1.5.2,
> 1.6 may be different, 2.0 will certainly be different.

John,
The C interface should be considered fairly stable. While there are
occaisional changes, they tend to be additions rather than revocations
of the existing functions.
2.0 should be considered a new beast entirely.


-Fred

--
Fred L. Drake, Jr. <fdrake@acm.org>
Corporation for National Research Initiatives
RFC: Viper: yet another python implementation [ In reply to ]
Andrew Csillag <andrew@starmedia.net> wrote:
>
>Also, you may want to look at how the SmallEiffel compiler does it's
>type inferencing...
>(and obviously the souce code is available to give you an implementation
>>to look at -- written in Eiffel).

Are you sure about the source code? Last time I looked
at SmallEiffel, they didn't give you the Eiffel source,
only the generated C code.

Has this changed? If so, it's very interesting.

Greg
RFC: Viper: yet another python implementation [ In reply to ]
Greg Ewing <greg.ewing@compaq.com> writes:

> Andrew Csillag <andrew@starmedia.net> wrote:
> >
> >Also, you may want to look at how the SmallEiffel compiler does it's
> >type inferencing...
> >(and obviously the souce code is available to give you an implementation
> >>to look at -- written in Eiffel).
>
> Are you sure about the source code? Last time I looked
> at SmallEiffel, they didn't give you the Eiffel source,
> only the generated C code.
>
> Has this changed? If so, it's very interesting.

It has. Full Eiffel source is now available.

SmallEiffel is now the official GNU Eiffel compiler.
So obviously source has to be available.

Greetings,

Stephan

1 2  View All