kem0x / Horizon-Lang

Experimental scripting language written in C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Horizon programming language

This repo contains the source code for the experimental Horizon programming language's interpreter and base compiler.

Disclaimer

This is a hobby project for educational purposes, and is not intended for production use. It is not feature complete, and is not guaranteed to be bug free. It is not intended to be a replacement for any other programming language, and is not intended to be used for any purpose other than for fun and learning.

Features

  • Statically typed
  • Interpreted
  • Javascript like syntax
  • Fast execution speed

For a more detailed list of features, see features document

Examples

Hello world

print("Hello {}", "World");

Fibonacci

function fib(n: Int): Int
{
    if (n <= 1)
    {
        return n;
    }

    return fib(n - 1) + fib(n - 2);
}

print("fib(10) = {}", fib(10));

FizzBuzz

let i: Int = 1;
loop (99)
{
    if (i % 15 == 0)
    {
        print("FizzBuzz");
    }
    else if (i % 3 == 0)
    {
        print("Fizz");
    }
    else if (i % 5 == 0)
    {
        print("Buzz");
    }
    else
    {
        print("{}", i);
    }

    i = i + 1;
}

Building

  • Prerequisite
    • Latest Visual Studio 2022, with C++ platform toolset v143
    • LLVM 14.0.4

Note: This project makes heavy use of C++23 features, and will not build with older versions of Visual Studio.

As of the current date (2/10/2023) intellisense is extremely broken on this project due to the use of c++ modules. This is not a problem with the project, but with Visual Studio itself, I personally use resharper++, it's broken aswell just more useable.

License

This project is licensed under the MIT license. See LICENSE for more details.

Contributing

Contributions are welcome, but please open an issue first to discuss the change you wish to make.

Acknowledgements

About

Experimental scripting language written in C++

License:MIT License


Languages

Language:C++ 99.4%Language:C 0.6%