Home IT Info News Today New Lever language builds on Python's convenience, aims for…

New Lever language builds on Python's convenience, aims for…

236

Lever, a new open source programming language now in its 0.8.0 release, may be inspired by Python, but it doesn’t intend to be limited by it.

Lever’s mission is to be a general-purpose programming language along the sames lines as Python (and Ruby and Perl), with the ability to compile easily to standalone executables and with grammar and syntax that can be customized freely. Its long-term ambition is to rival even the Python JITting compiler PyPy for speed.

Looks (sort of) like Python, runs (sort of) like Python

At a glance, Lever code looks a lot like Python; it uses much of the same syntax, like indented code blocks and # symbols to delineate comments. Lever also implements Python-like features like dynamic typing, interfaces to C code, and module imports. Developers coming from Python should have no trouble adapting; those with no Python experience shouldn’t find the language difficult to pick up.

It’s where Lever departs from Python, though, that things get interesting. For starters, Lever programs come with a built-in event loop that makes it easier for developers to write apps that make use of concurrency. One example is the sleep function: If it’s called with just a length of time to sleep, the entire program pauses. But if it’s given a callback, the program keeps executing and the callback is called after the stated interval, without the need to explicitly set up any other concurrency handling.

Another major departure is in the way the syntax for the program is specified. In Python, syntax is hard-wired; in Lever, the user can supply her own grammar and syntax rules or customize the existing ones.

Getting up to speed

Most of the truly ambitious goals for Lever are ways down the road. Chief among them is high performance, although little work has been done in Lever to achieve that goal as yet. For its runtime Level uses the same RPython sub-dialect of Python that’s been used to power PyPy, so theoretically it’s possible to “replicate some of RPython’s translation framework on Lever and repurpose it,” according to the developers. But there are no plans to displace PyPy, since PyPy and Lever have many goals that don’t overlap.

Another proposed possibility is for Lever to use WebAssembly, the project that allows in-browser code to run at native-code speeds, as a compilation target. That work is also a long way off — “somewhere between two to six years,” according to Lever’s developers — and would depend entirely on how much traction WebAssembly gains in the interim.

Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here