Introduction
Welcome to The Halcyon Book, the official documentation for the Halcyon programming language. Halcyon is a compiled, strongly typed, functional programming language. It is compiled to WebAssembly, a portable binary format that can run in the browser.
Getting Started
You can try out Halcyon in your browser using the online compiler.
If the online compiler is having issues, make sure your browser is fully up to date.
The Halcyon compiler is also available as a standalone executable called hcc.
To download it, go to the releases page, and pick the correct file for your operating system.
IDE Setup
Visual Studio Code
TODO
Helix
In your Helix config folder (~/.config/helix/ by default), create languages.toml if it does not already exist.
Add a grammar and language entry for Halcyon:
[[grammar]]
name = "halcyon"
source = { git = "https://git.lgatlin.dev/logan/tree-sitter-halcyon.git", rev = "main" }
[[language]]
name = "halcyon"
scope = "source.hc"
file-types = ["hc"]
grammar = "halcyon"
comment-tokens = ["--"]
block-comment-tokens = { start = "(*", end = "*)" }
Next, fetch and build the grammar. If this is your first time building grammars this will take several minutes.
helix -g fetch
helix -g build
Finally, download the highlight queries to your runtime directory:
mkdir -p ~/.config/helix/runtime/queries/halcyon
wget https://git.lgatlin.dev/logan/tree-sitter-halcyon/raw/branch/main/queries/highlights.scm \
-O ~/.config/helix/runtime/queries/halcyon/highlights.scm
Hello World
Time to write your first Halcyon program. Try compiling and executing this minimal program:
<span class='hljs-keyword'>module</span> hello_world =
<span class='hljs-keyword'>do</span> <span class='hljs-title class_'>std</span><span class='hljs-punctuation'>::</span><span class='hljs-title function_'>println</span> <span class='hljs-string'>"Hello World!"</span>
<span class='hljs-keyword'>end</span>