Getting startedSlide 2 of 86
2runGetting started

Running these examples

Every example from here on is a complete program: save it in a file ending in .hive and one command runs it. The compiler is a single executable, released for Linux, macOS and Windows on amd64 and arm64 as hivec-<os>-<arch>. Put it on your PATH as hive, the name its own messages use. Hive compiles to Go, so running or building a program also needs Go 1.24 or newer on the PATH; checking one needs nothing else.

  • hive check hello.hive reports what is wrong with a program without building it. Run it first, and after every edit.
  • hive run hello.hive compiles and runs in one step. The program starts in the entrypoint's folder, receives everything after the file name, and its exit status becomes the command's.
  • hive build hello.hive leaves a native executable beside the entrypoint.

A build writes the Go it generates to hello.hive-build/, beside the entrypoint, and deletes that folder first every time, so it is safe to ignore in version control. An error starts with file:line:, goes to standard error, and the command exits non-zero. Each compiler pass reports every mistake it finds, but a pass that found one stops the passes after it: fix the type errors, and the bounds errors behind them appear.

$ printf 'proc main(): void {\n\techo "it works"\n}\n' > hello.hive

$ hive check hello.hive
No problems found in hello.hive (0s)

$ hive run hello.hive
it works

$ hive build hello.hive
Compiled hello.hive -> hello (0s)