Skip to content

Python's Simplicity, C++'s Power, Native Interoperability with C, C++, Python, and Rust (W.I.P)

License

Notifications You must be signed in to change notification settings

kneorain/helix-lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Helix Programming Language Logo

| Website | Introduction | Quick Start | Project Status and Roadmap | Community and Contributing | License | Acknowledgements | Links |

Helix Programming Language: A Modern, High-Performance Language combining Rust, Python, and C++

Why Helix?

Helix is designed to address several limitations found in other modern languages like Rust and Zig:


Code Example

Key Goals of Helix:

  • High-performance: Designed to match or surpass the speed of C.
  • Safety: Focused on safe memory management without sacrificing developer productivity and freedom.
  • Robustness: Provides tools and features that ensure code stability and reduce runtime errors.

Design Philosophy:

  • Modern syntax: Inspired by Rust, but simpler, and understandable for anyone.
  • General-purpose: Suitable for a wide range of applications, from systems programming to game development and artificial intelligence.
  • Ease of use: Balances power with usability, making it friendly for both beginners and experienced developers.

Key Features:

  • Performance-centric: Designed to compete with C in terms of performance.
  • Expressive syntax: Combines Python's simplicity with Rust's modern constructs and C++'s power.
  • Type safety: Strong type system, but with the flexibility of python type annotations.
  • Interoperability: Seamless integration starting with C and C++, then expanding to other languages. With a extendable FFI system that allows for easy integration with any other languages.
  • Non-Erroring Borrow checker: Ensures safe memory management, similar to Rust's borrow checker but, Helix treats invalid borrows and ownership violations as warnings rather than errors, allowing the program to compile and run. but in a performance degraded mode, while still maintaining memory safety.

Applications:

  • Systems programming: Designed to work efficiently at the low level, close to hardware, while giving developers the freedom.
  • Game development: Provides the tools necessary for fast, real-time performance in complex applications.
  • AI development: Efficient enough for resource-intensive tasks like machine learning and artificial intelligence.

Error Reporting

Helix provides detailed and informative error messages to help with debugging:

Strong Typing with Flexible Generics

Helix allows for flexible typing with robust generic systems:

Asynchronous Programming

Helix supports asynchronous code with async and await:


Why Not Rust or Zig?

While both Rust and Zig are excellent languages, they come with certain trade-offs that Helix seeks to address:

  • Lack of OOP Support: Both Rust and Zig lack comprehensive OOP support, which is essential for certain domains like AI or game development.
  • Strict Safety Mechanisms (Rust): While Rust's borrow checker is a powerful tool, it can sometimes be too strict, leading to complex refactoring for developers.
  • Limited Features (Zig): Zig, while performant, lacks certain features like a macro processor that Helix provides.

Helix: The Best of Both Worlds

Helix draws inspiration from Rust, Python, and C++, combining the strengths of these languages while addressing their weaknesses:

  • Balanced Safety: Helix features a borrow checker, but with a less strict enforcement, offering flexibility without sacrificing safety.
  • Simpler Syntax: Helix provides a modern, Python-like syntax, reducing verbosity while maintaining power.
  • OOP Support: Helix fully supports object-oriented programming, making it suitable for a wide range of applications.

Quick Start

Installation & Build

Warning

Helix is currently under development and does not yet have a useable compiler. The following instructions are for development and building the compiler itself.

Tip

Linux is not yet tested, Most development is done on MacOS or Windows, if any issues arise with building on Linux, please open an issue.

Prerequisites

Windows Specific (Visual Studio Build Tools)

Caution

Only msvc is supported and tested on Windows, gcc is not supported on Windows. and mingw is not tested.

  1. Install Visual Studio Build Tools and select the following components:

    • Desktop development with C++ (workload)
    • MSVC v143 or higher
    • Windows SDK
    • C++ CMake tools for Windows
    • C++ Clang Tools for Windows v17.0.x or higher
    • C++ ATL for v143 build tools or higher
  2. Install Python

  3. Install xmake (PowerShell Only)

$ Invoke-Expression (Invoke-Webrequest 'https://xmake.io/psget.text' -UseBasicParsing).Content
MacOS, Unix or Linux Specific (clang or gcc)

Warning

Perl is required for building on Linux, if you don't have it installed, install using your package manager.

  1. Install Python

  2. Install Xmake (bash or zsh):

curl -fsSL https://xmake.io/shget.text | bash
  1. Install necessary build tools such as Clang or GCC. (should be installed by default on MacOS)
All Platforms (After following platform specific steps)
  1. Make a directory for the project and clone the repo
$ git clone https://github.com/kneorain/helix-lang.git
$ cd helix-lang
  1. Build Helix along with the LLVM backend, Clang, Tests, and the Helix Compiler Toolchain API (~30 minutes on a 8-core CPU)
$ xmake build
  1. Run the tests or the compiler
$ xmake run tests
$ xmake run helix -h

Hello, World!

Here's how you can write and run a simple "Hello, World!" program in Helix:

// hello_world.hlx
print("Hello, World!");

To compile then run the source:

$ ./build/.../bin/helix hello_world.hlx
or
$ helix hello_world.hlx
$ ./hello_world

Project Status and Roadmap

Helix is currently in the early stages of development, currently focusing on the toolchain and compiler. The project is under active development, and we are working hard to bring you a 0.0.1 release soon.

At this point the compiler is usable, but errors only extend to syntax errors, any errors related to code are not yet implemented such as type errors, undefined variables, etc.

Checklist for the 0.0.1 release:

Compiler

  • lexer
  • preprocessor
  • ast parser
  • cst parser
  • semantic analyzer
  • code generator
  • optimizer
  • linker
  • compiler api
  • compiler cli
  • compiler tests
  • compiler documentation

Language

  • basic syntax
  • functions
  • classes
  • modules
  • generics (requires)
  • type bounds
  • enums
  • structs
  • async/await
  • spawn/thread
  • ffi c
  • ffi c++
  • ffi python
  • ffi rust
  • error handling
  • macros
  • attributes
  • concurrency
  • pointers
  • references
  • modules
  • operator overloading
  • type inference
  • type aliases
  • type casting
  • type checking
  • interfaces
  • inheritance
  • extends keyword
  • imports
  • test keyword (language level testing framework)

Community and Contributing

Helix is an open-source project, and we welcome contributions! Whether it's fixing bugs, improving documentation, or adding new features, your contributions are valuable.

Read our Contributing Guide for more details.


License

Helix is licensed under the Attribution 4.0 International License. See the LICENSE for more details.


Acknowledgements

We want to thank all contributors for their efforts in making Helix a reality. Your work is appreciated!


Happy coding with Helix! 🚀


Links