The-Spiral-Language  by mrakgr

Functional language for intensional polymorphism and first-class staging

created 7 years ago
938 stars

Top 39.9% on sourcepulse

GitHubView on GitHub
Project Summary

Spiral is a statically typed, functional programming language designed for high-performance computing, particularly targeting novel AI hardware. It aims to bridge the gap between expressive, high-level languages like Lisp and low-level, performant languages like C by offering first-class staging, intensional polymorphism, and fine-grained control over memory allocation and inlining. Its primary use case is the development of machine learning libraries for specialized hardware.

How It Works

Spiral employs a staged functional programming paradigm, distinguishing between a top-down segment (ML-style type system with unification) and a bottom-up segment (partial evaluation). This dual approach allows users to leverage powerful static type checking for most of their code while enabling low-level control and metaprogramming capabilities through partial evaluation. Key features include join points for function specialization, a flexible type system with support for higher-ranked types and GADTs, and macros for language interop and code generation.

Quick Start & Requirements

  • Installation: Install the "The Spiral Language" plugin from the VS Code marketplace. This includes the editor plugin and the compiler.
  • Prerequisites: .NET 8 SDK.
  • Setup: The compiler is portable. The language server uses websockets, so ensure firewall access.
  • Documentation: Spiral Language Overview

Highlighted Details

  • Staged Programming: Combines a top-down type system with a bottom-up partial evaluator for performance and expressiveness.
  • Intensional Polymorphism: Enables advanced type-level programming and metaprogramming.
  • Cuda Backend: Supports GPU programming with features like noinline_ for join points and \v for Cuda array declarations.
  • ML Library Focus: Designed with the creation of ML libraries for AI hardware as a primary goal.

Maintenance & Community

The project is actively developed by mrakgr, with recent updates adding GADTs and higher-ranked types. There is a YouTube channel with a playlist dedicated to Spiral.

Licensing & Compatibility

The README does not explicitly state a license. Compatibility for commercial use or closed-source linking is not specified.

Limitations & Caveats

  • The project is still under active development, with features like existentials and GADTs having backend limitations (e.g., no runtime code generation).
  • Some advanced features, like bottom-up type inference, are complex and may not be suitable for all users.
  • Editor support is noted as lacking certain features like autocompletion and highlighting of unused variables compared to mature languages like F#.
Health Check
Last commit

1 month ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
8 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.