From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA03951 for caml-redistribution; Thu, 30 Dec 1999 11:40:11 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA20265 for ; Sat, 25 Dec 1999 23:47:09 +0100 (MET) Received: from ruby (cartman17.zip.com.au [61.8.20.145]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id XAA00938 for ; Sat, 25 Dec 1999 23:46:49 +0100 (MET) Received: from maxtal.com.au (IDENT:root@localhost [127.0.0.1]) by ruby (8.9.3/8.9.3) with ESMTP id JAA03743 for ; Sun, 26 Dec 1999 09:48:31 +1100 Sender: weis Message-ID: <386549AD.DD177D2A@maxtal.com.au> Date: Sun, 26 Dec 1999 09:48:13 +1100 From: skaller Organization: Maxtal X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.12 i586) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.python CC: caml-list@inria.fr Subject: Viper- Dec 1999 progress report Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit posted to caml-list@inria.fr and comp.lang.python Viper - an python interpreter/compiler project written in ocaml and C, for python and ocaml enthusiasts, and those concerned with high performance computing with python. --------------------------------------------------------------- Here's a brief progress report on the Viper project. Viper 2.0 alpha 1 is (temporarily) available from ftp://ftp.cs.usyd.edu.au/jskaller/viper_2_0_a1.tar.gz I don't recommend you download this version unless you are serious about contributing or testing, or just extremely curious. :-) Ocaml (http://caml.inria.fr), CPython (http://www.python.org) and Un*x is required to build it (use the 'maker' script). The current (temporary) licence permits redistribution of the unmodified tarball; you can also modify the sources, distribute the mods as patches, but NOT redistribute modified sources as a whole (this is to stop some big well funded corporation cashing in on my work without negotiation) ---------------------------------------------------------- Verion 2.0 alpha 2 features. Note: alpha 2 is NOT yet available. Too much code is 'unfinished'. Let me know which bits you'd like to see finished first. A list of alpha 1 features is given below. COMPILER and CPYTHON run time access. ===================================== Alpha 2 now links against the CPython run time, it is possible to run CPython from within Viper, including loading CPython extension modules, and letting CPython run scripts instead of Viper. There is proof of principle support for both converting between Viper and CPython representations, and wrapping them as opaque objects (in both directions). I'm working on a C code generator function that takes a Viper imported module, and creates a text file which can be compiled with a C compiler, then loaded into CPython as an extension module. OPTIONAL TYPE DECLARATIONS ========================== Viper now supports type declarations in two ways: The expression: expr ! typeexpr is evaluated as expr if the type of expr is typeexpr, otherwise a TypeError exception is raised. Function parameters may be declared like: def f(param:typeexpr) and matching arguments are checked at the point of call. [Adapted from a suggestion of Greg Stein] WITH/DO STATEMENT ================== New syntax is introduced. The With/Do statement is written like: with: x = 1 y = 2 do: z = x + y The with block is evaluated, and new symbols (x,y) created in a temporary dictionary. Then the do block is executed, with the temporary dictionary available read only, write-bypass, so that z ends up in the global scope. Finally, the temporary dictionary is deleted. The code above is equivalent to x = 1 y = 2 z = x + y del x,y except that there is no risk of a clash for the temporary names, and you don't have to remember to 'del' them. [Adapted from ML's let .. in construction] RENAMING EXTENSION IN IMPORT STATEMENTS ======================================== Import statements now allow a suffix to import an object with a new name. For example: import x as y from m import a as b, d as e This saves having to write code like _x = x from m import x new_x = x x = _x del x to resolve name clashes. C STYLE ASSIGNMENT OPERATORS AS STATEMENTS ========================================== All the C assignment operators (+= etc) plus pre and post increment and decrement are available in single assignment statements for example: x++ x+=1 Note that these cannot be used in expressions or multiple assignments. NESTABLE C STYLE COMMENTS ========================= C style /* comments */ can be used an nested. INTERNATIONAL CHARACTERS IN IDENTIFIERS ======================================= Any letter can be used in an identifier. The only encoding supported is UTF-8 encoded ISO-10646. In particular, Latin-1 encoded non-Ascii characters will be rejected. The full set of letters allowed is detailed in: ISO Standard C++, Appendix E. The source for that was: ISO/IEC PDTR 10176, produced by ISO/IEC JTC1/SC22/WG20 (internationalisation). AFAIK, this set agrees with Unicode. All the supported letters are from the Basic Multilingual Plane (Unicode). RAW OBJECTS =========== New raw objects can be constructed, and any object set as the type object. A demo of showing how to construct a checked list-of-int is provided. It remains to be seen if this is enough to provide generic containers. BUILTIN GRAPHICS USER INTERFACE =============================== Viper provides a builtin GUI, currently using Gtk as the basic C toolkit. Most widget constructors are implemented (but only a few of the other methods). LIBRARY MODULES =============== Most of the socket module is now implemented. The thread module is implemented. The interpreter, however, is not yet thread safe. Yet to do: operator, array, NumPy, and some others, finish other partially implemented modules including re. Finish implementing mapping/dictionary methods. Finish providing support for special class methods. Good news: ocaml 3.00 will probably support finalisers, so __del__ methods can be made to work. ALPHA 1 FEATURES ================ Underscores in numeric literals like 1_223_444. Sane radices for numeric literals: 0x - hex 0o - octal 0d - decimal 0b - binary Full ISO-10646 support for string literals, using UTF-8 encoding, and \u and \U escapes. Builtin support for arbitrary precision rational numbers. Strides in slices are fully implemented. Name binding is available for functions and modules. (names are translated to indexes into an array like CPython does for locals in functions) Functions and classes are lexically scoped. For example: def f (x): def g(y): return x + y return g(1) print f(2) will print 3. Any object can act as a type object in Viper, type objects are consulted for attributes if normal attribute lookup fails (including methods). -- John Skaller, mailto:skaller@maxtal.com.au 10/1 Toxteth Rd Glebe NSW 2037 Australia homepage: http://www.maxtal.com.au/~skaller voice: 61-2-9660-0850