Use Hachi

Make sure clang++ and make are installed.

git clone https://gitlab.com/hachi-lang/hachi
cd hachi
make

There is now an install script accessible. To install, just run:

curl -fsSL https://hdev.run/install | bash

That’s it. It’s suggested that your Hachi executable be placed in your PATH somewhere. Additionally, set HACHI_LIB to the lib directory. When importing modules, Hachi will look in the HACHI_LIB first, and if the module doesn’t exist there then imports become relative paths.

$ hachi -h
...
╔════════════════════════════════════╗
║ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⣄⠀⠀⠀⠀⠀⣀⣤⠀⠀⠀   ║
║ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡸⠁⠌⣆⠀⠀⠀⣴⡟⠊⡇⠀⠀   ║
║ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢐⡇⠁⠄⣸⡿⣿⡛⢿⣕⠀⡆⠀⠀   ║
║ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣇⣼⣾⣻⠝⠉⠓⠀⠏⠙⠅⠀⠀   ║
║ ⠀⢀⠔⢒⠒⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⣻⠷⠛⠁⠨⣯⠂⠀⠸⠓⡇⠀⠀   ║
║ ⣰⠉⢀⡎⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⡇⠀⠀⠀⢀⡀⠀⠀⠀⢠⣾⣷⠄   ║
║ ⡟⢠⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⣷⠀⠀⠀⠀⠘⢆⣤⣀⣀⡽⠍⠀   ║
║ ⢡⠨⣟⣾⣶⣄⣀⢀⣀⣀⣤⣤⣤⣤⣤⣶⣿⣿⣿⣯⣷⡀⠀⠀⠨⠐⠨⢴⠞⠁⠀⠀   ║
║ ⠈⠢⣈⣻⡾⢿⣿⢿⣟⣿⣻⣽⣻⣽⢯⣟⣷⣟⣾⣳⣧⠑⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀   ║
║ ⠀⠀⠀⠉⢩⣿⢯⣿⣞⣯⡷⣿⣽⢾⣟⡿⣾⡽⣾⣻⡙⡇⠀⠀⠀⠀⠀⢑⠃⠀⠀⠀   ║
║ ⠀⠀⠀⠀⣾⣟⣯⣷⣻⣽⣿⣳⣯⢿⣞⣿⣳⡿⣯⣷⠇⠀⠀⠀⠀⠀⡰⠏⠀⠀⠀⠀   ║
║ ⠀⠀⠀⠀⣿⣯⣟⣾⡽⡻⠤⠄⣊⠉⠙⠚⠙⣿⣳⡿⠀⡐⠀⡀⣄⢔⡇⠀⠀⠀⠀⠀   ║
║ ⠀⠀⠀⡠⠿⠷⠏⣋⠜⡇⠀⠀⢠⠏⠒⠒⣦⠉⠉⠀⢠⠥⡔⠈⠅⢸⠀⠀⠀⠀⠀⠀   ║
║ ⠀⠀⡜⠀⢀⡴⠊⠁⣜⠁⢀⡔⠁⠀⠀⠀⠸⡀⠀⠀⡸⠀⡃⠁⠀⡞⠀⠀⠀⠀⠀⠀   ║
║ ⠀⠀⡇⠀⡜⠀⠀⠀⠘⡄⠈⣇⡀⠀⠀⠀⠀⡇⠀⠀⡇⠀⢹⠀⠀⣧⠀⠀⠀⠀⠀⠀   ║
║ ⠀⢰⠁⢂⠱⢆⠀⠀⠀⠑⢀⣑⣘⡧⠀⠀⠀⢹⠀⠀⢇⠀⠐⢆⠀⠸⠤⢄⠀⠀⠀⠀   ║
║ ⠀⠀⠉⠘⠂⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣇⠈⢉⢉⡄⠈⠂⠤⠤⠭⠃⠀⠀⠀   ║
║  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀   ║
║  🌟🌌   WELCOME TO HACHI!   🌌🌟   ║
╚════════════════════════════════════╝
🔥 Hachi v0.2.2 – Code like a legend! 🔥
👑  Author: Mike Curnow
🚀  Usage : hachi [⚙ options] [📄 source.hachi] [⚙ options]

✨ OPTIONS ✨
  -v, --version       Show Hachi version and exit
  -h, --help          Show this help screen
  -d, --debug         Enter debug mode before execution
  -i, --init          🔧 Bootstrap a new Hachi project here
  -cpp <file>         ↗️  Emit transpiled C++ to <file>
  -b, --build <file>  ⚙️  Compile Hachi into a binary
  -buildml <file>     🐞 Leak-detector build (memory insights)
  -go                 ▶️  Build & run on the fly
  -w, --watch         👀 Watch source and imports, auto rebuild/run
  --graph             🧬 Show dependency import graph
  --stats             📊 Show execution timing statistics
  --check             ✅ Validate only (no build/run)
  --clean             🧼 Remove Hachi build artifacts
  -cf <flags>         🛠️  Pass custom flags to your C++ compiler
  -target <triple>    🎯 Cross-compile target (arch triple)
  [cpp] -cc <flags>   📦 Hachi-driven C++ build commands
  -c <code>           📝 Run inline Hachi snippet & exit

💡 Pro Tip: Mix & match flags to suit your workflow. Stay Legendary! 💡

After installing Hachi, you probably gonna want to run this puppy. So to start off, you can simply run hachi -h to see all commands you can run.


Modern Workflow (v0.3)

Hachi now supports a much faster development loop.

Watch Mode

Automatically rebuilds and reruns your program when files change:

hachi file.hachi --watch
  • Tracks the entry file and all imported modules
  • Rebuilds when any dependency changes
  • Emits timestamped logs

Example:

2026-03-22 21:03:11 File Changed: fmt.hachi -> Rebuilding

Check Mode

Validate code without running or compiling:

hachi file.hachi --check
  • Parses
  • Resolves imports
  • Validates structure

Output:

✅ check passed

or

❌ check failed

Stats

See where time is spent:

hachi file.hachi -go --stats

Example:

[Hachi Stats]
Resolve:    8 ms
Transpile:  14 ms
Compile:    392 ms
Run:        27 ms
Total:      441 ms

Import Graph

Visualize dependencies:

hachi file.hachi --graph

Outputs a structured tree of module imports.


Clean

Remove temporary build artifacts:

hachi --clean

Compile

-build

This builds the executable from a defined Hachi file.

Syntax:

hachi <filename>.hachi -build <program-name>

Example:

hachi sk.hachi -build skate
./skate

-buildml

Builds the executable and checks for memory leaks.

Primarily useful when embedding raw C++ via outerCPP or innerCPP.

⚠️ Note:

  • Some Hachi internals may still be flagged
  • Best used when debugging unsafe embedded C++

Syntax:

hachi <filename>.hachi -buildml <filename>

Cross-Compilation

Supports cross-compilation using target triples.

Syntax:

hachi <filename>.hachi -build <program-name> -target <target-triple>

Example:

hachi sk.hachi -build skate -target aarch64-unknown-linux-gnu

More Commands

-cpp

Translates Hachi to C++.

hachi <filename>.hachi -cpp output.cpp

-d / -debug

Runs with visual debug output (AST + Action Tree).

hachi file.hachi -d

(Example output unchanged below)


-cf

Pass custom C++ compiler flags.

hachi file.hachi -cf "-std=c++17 -ldl" -build program

-cc

Use Hachi as a C/C++ build tool.

hachi file.cpp -cc "-std=c++17 -ldl -o program"

-c

Inline execution (like Python):

hachi -c ">@ \"fmt/fmt\" shout: \"Hachi is awesome!\""

Run

-go

Compile and run in one command:

hachi file.hachi -go

Supports arguments:

hachi cliArgs.hachi -go These Are Arguments