**Work in Progress. Not Ready!**
npm install @shd101wyy/yoWork in Progress. Not Ready!
A multi-paradigm, general-purpose, compiled programming language.
Yo aims to be Simple and Fast (around 0% - 15% slower than C).
> The name Yo comes from the Chinese word 柚 (yòu), meaning pomelo, a large citrus fruit similar to grapefruit. It's my daughter's nickname.
- First-class types.
- Compile-time evaluation.
- Homoiconicity and metaprogramming (Yo syntax is inspired by the Lisp S expression).
- Closure.
- Async/await (Stackless coroutine & Cooperative multi-tasking).
- object type with Non-atomic Reference Counting and Thread-Local Cycle Collection.
- Compile-time Reference Counting with Ownership and Lifetime Analysis.
- Thread-per-core parallelism model (see PARALLELISM.md).
- C interop.
- etc.
For the design of the language, please refer to DESIGN.md.
The Yo language is currently distributed as an npm package:
``bash`
$ npm install -g @shd101wyy/yo # Install yo compiler globally
$ yarn global add @shd101wyy/yo # Or using yarn
$ pnpm add -g @shd101wyy/yo # Or using pnpm
$ bun install --global @shd101wyy/yo # Or using bun
It exposes the yo command in your terminal.
There is also an alias yo-cli for yo command in case of naming conflicts.
Run yo --help or yo-cli --help to see available commands.
Yo currently transpiles to C and requires a C compiler to produce machine code. Clang is recommended for the best experience.
#### Installing Clang
Linux:
`bashUbuntu/Debian
$ sudo apt-get update
$ sudo apt-get install clang
macOS:
`bash
Clang is included with Xcode Command Line Tools
$ xcode-select --installOr install via Homebrew
$ brew install llvm
`Windows:
`bash
Using Chocolatey
$ choco install llvmUsing Scoop
$ scoop install llvmOr download from https://releases.llvm.org/
`Alternatively, you can use other C compilers like
gcc or zig by specifying the compiler with the --c-compiler flag.$3
On Linux, Yo uses
io_uring for async I/O, which requires liburing to be installed.#### Installing liburing (Linux)
`bash
Ubuntu/Debian
$ sudo apt-get update
$ sudo apt-get install liburing-devFedora/RHEL
$ sudo dnf install liburing-develArch Linux
$ sudo pacman -S liburing
`Code examples
Check the ./tests and ./std folders for code examples.
$3
`typescript
// main.yo
{ println } :: import "std/fmt";main :: (fn() -> unit) {
println("Hello, world!");
};
export main;
// $ yo compile main.yo --release -o main
// $ ./main
`Development
The
Yo compiler is written in TypeScript and uses Bun as the runtime.Yo is primarily developed on the Steam Deck LCD (Linux). The compiler currently transpiles Yo to C; to produce
machine code you must have a C compiler (for example
gcc, clang, zig, cl, etc).Please install nix and direnv before proceeding.
The dev environment is defined in shell.nix. You can also manually install the dependencies listed in the file.
$3
`bash
$ cd Yo
$ direnv allow . # Run this command to activate the nix shell.
# You only need to run it once.
$ bun install # Install necessary dependencies.
`Run the following command to watch for changes and build the project:
`bash
$ bun run dev
`Run the following command to build the project:
`bash
$ bun run build
`Test the local yo-cli:
`bash
$ bun run src/yo-cli.ts compile src/tests/examples/fixme.yoThere is also a
yo-cli script in the project root for testing:
$ ./yo-cli compile src/tests/examples/fixme.yo
`Editor Support
- A VS Code extension is available here that supports basic syntax highlighting. No LSP yet.
- Vim / Neovim: a minimal syntax file and a usage README are available in
vscode-extension/syntaxes/.
See vscode-extension/syntaxes/README.md for installation steps, ftdetect examples and home-manager` snippets.