VSL is an experimental project to explore how modern optimizations can reduce the overhead needed to implement high-level semantics. The most common cause of overhead in modern languages is efficient and secure memory management. JVM is a fascinating case study in this respect as it is one of the most ambitious implements of a mark-and-sweep collectors. More novel approaches include reference counting which omit runtime interruption with a proportional overhead and rust-esque approaches which result in un-ergonomic syntax.
The goal behind VSL was to explore how effectively reference counts could be optimized and evaluated at compile-time. By operating at a low-level with expressive semantics, it makes an effective choice for interoperability which I developed basic demos for deployment for native iOS, Objective-C, Swift, and web platforms.
Demo Link
See a (slightly outdated) demo on Try it online!
Link to Code
Language Documentation — API Documentation
Versatile Scripting Language
VSL is a modern, powerful, fast, and easy to write programming language designed for the 21st century.
Download
You can either build from source (see Building) or installed a pre-compiled binary/executable:
Changes
Git revision history is a mess but checkout CHANGELOG.md for detailed devleopment information.
Building
Building isn't too diffiult. Usually you'll want to install a pre-built binary but if you're feeling adventurous or just want to help build VSL (:D) building from source is simple:
$ git clone --recursive https://github.com/vsl-lang/VSL
$ npm install
$ npm run build
Do note, branch of the develop
branch to make changes. All PRs go there. Other
commands:
$ npm run coverage # Generates testing coverage reports
$ npm test # Runs all tests
$ npm run dev # Development build
$ npm run docs # Make docs
$ npm
…How I built it (what's the stack? did I run into issues or discover something new along the way?)
This is one of the most theoretically and technically complex projects I've worked on. The major flaw was implementing the compiler in Node.js. VSL's syntax is a relatively advanced context-sensitive grammar and managing massive tree transformations and graphs in Node.js is the bane of tracing garbage collectors.
The goal of the language was to optimize the compiled code as much as possible however this is a relatively heavy task for the compiler. It requires manipulating large data structures to track data flow over tens of thousands of lines of code and graphs with potentially millions of nodes. Such a task would be better suited for a language like Go or C++ where a more asynchronous and more fine-grained implementation of the toolchain could be done.
The actual language itself runs on top of the LLVM compiler infrastructure along with some hacks I implemented in a bindings fork to best interact with underlying system libraries.
The WebAssembly layer runs on a (likely buggy) heap allocator which weakly manages references to JavaScript objects to be able to fully access DOM APIs from the language.
The Python interoperability layer was in progress but the compiler generated direct calls to CPython's libraries.
The Objective-C/Swift interoperability layer could seamlessly directly call any API through a Clang bridge.
Top comments (0)