YakshaLang / Yaksha

😈 Yaksha Programming Language - Offside rule + Lisp system for macros. 🐣 WIP
https://yakshalang.github.io/
GNU General Public License v3.0
201 stars 12 forks source link
c99 compile-time compile-to-c compiler lisp-dialect offside offside-rule programming-language transpiler

Yaksha Programming Language


https://yakshalang.github.io/

.github/workflows/development.yml .github/workflows/coverage.yml .github/workflows/release.yml

Documentation

Communities

reddit github-discuss discord twitch

Overview

Welcome to Yaksha an offside-rule based language (Python inspired) that compiles to C99 with Lisp based macros.

Examples

Offside Rule (Python inspired) Syntax

# Example Yaksha Code
def main() -> int:
    println("Hello World")
    return 0
# return can be omitted
def main() -> int: 0

Compile time macros (YakshaLisp)

# β•”β•β•—β”Œβ”€β”β”Œβ”¬β”β”Œβ”€β”β”¬β”¬  β”Œβ”€β”  β•”β•¦β•—β”¬β”Œβ”¬β”β”Œβ”€β”
# β•‘  β”‚ β”‚β”‚β”‚β”‚β”œβ”€β”˜β”‚β”‚  β”œβ”€    β•‘ β”‚β”‚β”‚β”‚β”œβ”€
# β•šβ•β•β””β”€β”˜β”΄ β”΄β”΄  β”΄β”΄β”€β”˜β””β”€β”˜   β•© β”΄β”΄ β”΄β””β”€β”˜
# β•”β•β•—β”¬β”Œβ”€β”β”Œβ”€β”  β•”β•— ┬ β”¬β”Œβ”€β”β”Œβ”€β”
# β• β•£ β”‚β”Œβ”€β”˜β”Œβ”€β”˜  β• β•©β•—β”‚ β”‚β”Œβ”€β”˜β”Œβ”€β”˜
# β•š  β”΄β””β”€β”˜β””β”€β”˜  β•šβ•β•β””β”€β”˜β””β”€β”˜β””β”€β”˜
macros!{
    (defun to_fb (n) (+ (if (== n 1) "" " ") (cond
        ((== 0 (modulo n 15)) "FizzBuzz")
        ((== 0 (modulo n 3)) "Fizz")
        ((== 0 (modulo n 5)) "Buzz")
        (true (to_string n))
        )))
    (defun fizzbuzz () (list (yk_create_token YK_TOKEN_STRING (reduce + (map to_fb (range 1 101))))))
    (yk_register {dsl fizzbuzz fizzbuzz})
}

def main() -> int:
    println(fizzbuzz!{})
    0

Key Features

Why Yaksha?

Why not Yaksha?

Getting Started

To explore the language and its capabilities, refer to the Yaksha Documentation. This comprehensive guide covers the philosophy, syntax, and features of Yaksha.

Demos

Check out the fun demos showcasing Yaksha's capabilities: 😺

Contribution

We welcome contributions and feedback. Please use GitHub Issues for bug reports, feature requests, and head to discord for discussions. If you prefer forums you can use GitHub discussions.


 ==============================================================================================
 ╦  β”¬β”Œβ”€β”β”Œβ”€β”β”Œβ”β”Œβ”Œβ”€β”β”Œβ”€β”    Yaksha Programming Language
 β•‘  β”‚β”‚  β”œβ”€ β”‚β”‚β”‚β””β”€β”β”œβ”€     is Licensed with GPLv3 + extra terms. Please see below.
 β•©β•β•β”΄β””β”€β”˜β””β”€β”˜β”˜β””β”˜β””β”€β”˜β””β”€β”˜
 Note: libs - MIT license, runtime/3rd - various
 ==============================================================================================
 GPLv3:

 Yaksha - Programming Language.
 Copyright (C) 2020 - 2024 Bhathiya Perera

 This program is free software: you can redistribute it and/or modify it under the terms
 of the GNU General Public License as published by the Free Software Foundation,
 either version 3 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.
 See the GNU General Public License for more details.

 You should have received a copy of the GNU General Public License along with this program.
 If not, see https://www.gnu.org/licenses/.

 ==============================================================================================
 Additional Terms:

 Please note that any commercial use of the programming language's compiler source code
 (everything except compiler/runtime, compiler/libs and compiler/3rd) require a written agreement
 with author of the language (Bhathiya Perera).

 If you are using it for an open source project, please give credits.
 Your own project must use GPLv3 license with these additional terms.

 You may use programs written in Yaksha/YakshaLisp for any legal purpose
 (commercial, open-source, closed-source, etc) as long as it agrees
 to the licenses of linked runtime libraries (see compiler/runtime/README.md).

 ==============================================================================================