- π Standard Library
- π£ Tutorials
- π Documentation
- π Proposals Repo π Read Proposals
- π Demos with source code
- β½οΈ Playground
- π€ (B)log
- β Plan / Tasks
Welcome to Yaksha an offside-rule based language (Python inspired) that compiles to C99 with Lisp based macros.
# Example Yaksha Code
def main() -> int:
println("Hello World")
return 0
# return can be omitted
def main() -> int: 0
# ββββββββ¬βββββ¬β¬ βββ ββ¦ββ¬ββ¬ββββ
# β β βββββββββ ββ€ β ββββββ€
# βββββββ΄ β΄β΄ β΄β΄βββββ β© β΄β΄ β΄βββ
# ββββ¬ββββββ ββ β¬ β¬ββββββ
# β β£ βββββββ β β©ββ βββββββ
# β β΄ββββββ ββββββββββββ
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
-
Python like Syntax: The language syntax is reminiscent of Python, making it accessible and easy to learn for developers familiar with Python and C.
-
Compilation to C99: Yaksha compiles to C99, enabling efficient execution. Has support for full threads. (No such a thing as GIL).
-
WebAssembly Support: The compiled code can be further transformed into WebAssembly, allowing Yaksha programs to run seamlessly in web browsers. (Just enable emascipten shell and run
yaksha build
) -
Lisp-based Macros: Dive into advanced meta programming with a Lisp-based macro language, offering powerful tools for zero-cost abstraction and code generation. (There are metamacros too!, allowing you to write macros in YakshaLisp to be used at YakshaLisp level)
-
Raylib Integration: Yaksha integrates with the Raylib game development library, enabling developers to create games with ease.
-
WASM4 Fantasy Console Integration: Yaksha provides library support for the WASM4 fantasy console, allowing developers to create games for the WASM4 fantasy console. (You just need w4 binary in PATH)
-
IntelliJ/Notepad++/VsCode Support: Yaksha provides syntax highlighting support for the IntelliJ, Notepad++, and VsCode editors. (Just grab it from release)
-
Cross Platform: Yaksha is cross-platform, works on Windows, Linux, and macOS ( π macOS is work in progress, installer is not yet provided). You can even cross compile to WASM (using Emscripten) on Linux / Windows for browser execution. Yaksha bundles
zig
compiler (usezig cc
) for cross compilation, allowing you to compile multiple targets from a single machine. -
Playground is a full Debian x86 VM running in browser: Yaksha playground is a full linux terminal with all the tools you need to develop Yaksha programs. (https://yaksha.pages.dev/)
-
Static binaries: Yaksha provides static binaries for Linux (musl) (Using
zig cc
). -
Hot reloading (raylib games/apps) - (π Currently only works in Windows)
-
Web Apps: The seamless integration with WebAssembly makes Yaksha an excellent choice for browser-based applications.
-
Mini Game Development: The Raylib integration and WASM4 fantasy console support make Yaksha a great choice for game development.
-
Console Applications: Yaksha is a great choice for console applications, providing a simple and efficient language for developing command-line tools. (Library is cross-platform, so you can use it to develop cross-platform console applications).
-
Meta Programming: The Lisp-based macro language facilitates advanced meta programming, empowering developers with expressive code generation capabilities. You can do lot in compile time without going into madness of things like template meta programming (in C++) or
#define
macros. You can even use meta-macros to write macros in YakshaLisp to be used at YakshaLisp level. (YakshaLisp is a garbage-collected language unlike Yaksha). -
New Philosophy: Yaksha is a new language with a new philosophy. Yaksha use offside rule (Python inspired) syntax, and at the same time we use a Lisp based macro system. I think these two things complement each other very well.
- In other words - Allowing us to explore dualism and harmony of opposites in a programming language. π§ π€―
- Yaksha is not Python: Although Yaksha's syntax is inspired by Python, it is not a Python clone. The language is designed to be familiar to Python developers, but it is not a drop-in replacement for Python (and never will be).
- Yaksha is not a scripting language: Yaksha is a compiled language, not a scripting language. It is designed to be compiled to C. It is not intended to be interpreted. However, YakshaLisp can be used as a scripting language (
yaksha lisp script.lsp
). - Yaksha is not Rust: Yaksha compiles to C, and it does not provide compile time safety checks like Rust. However, it is heavily type-checked during compile time (may have bugs at the infancy of the language). Additionally
defer
is supported for much simpler resource management. - Yaksha is not a Lisp: Yaksha is not a Lisp, but it does provide a Lisp-based macro language for meta programming.
- Yaksha is not a mature language (π Yet): Yaksha is still in its infancy. It is not yet ready for production use. (If you fancy a challenge, feel free to try it out!)
- Yaksha is not Object-Oriented (π Yet): Yaksha is not an object-oriented language. It is procedural programming language with a Lisp-based macro language for meta programming.
- DLL/So/Dylib or static library creation is not supported (π Yet): This maybe available in future. Currently, you can only create executables.
- You are allergic to indentation based syntax, Lisp, C(99) or meta programming.
- Logo is too scary for you.
To explore the language and its capabilities, refer to the Yaksha Documentation. This comprehensive guide covers the philosophy, syntax, and features of Yaksha.
Check out the fun demos showcasing Yaksha's capabilities: πΊ
-
Fractal Tree Demo: Experience Yaksha compiled to WebAssembly running in the browser.
-
Space Blast Demo: Have fun with a space-themed game.
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).
==============================================================================================