Skip to content

hg CLI reference

hg is the Hellig command line. It's a thin wrapper around Compiler + Runtime + Session.

Synopsis

hg [OPTIONS] COMMAND [ARGS]...

Running hg with no subcommand opens the interactive REPL.

Global options

Flag Description
--version Print version and exit
--help Show help

Commands

hg version

hg version
# hellig 0.0.1

hg compile SOURCE...

Compile the given source and print the resulting Program without executing it. Useful for debugging compiler output and for learning the stub compiler syntax.

hg compile '? name -> name
: hi {name}'
ask(prompt='name', var='name')
say(text='hi {name}')
done()

hg run SOURCE...

Compile the given source and execute it in a fresh session. Reads stdin to answer any ask prompts.

Flag Description
--show-program / --no-show-program Print the compiled program before running.
hg run --show-program '? city -> city
: forecast for {city} is sunny'

hg repl

Explicitly start the interactive REPL. Equivalent to running hg with no arguments.

REPL

hellig 0.0.1 — natural language programming.
hg »

Every line you type is sent through the compiler and executed as one turn. Scope persists across turns within the session.

Built-in slash commands

Command Effect
/help Show the banner and directive reference
/history List previous user inputs in this session
/scope Dump the runtime scope
/reset Clear scope and history
/compile <src> Compile <src> and print the program without running
/exit, /quit, /q Leave the REPL

Directive cheatsheet

? question -> var        # ask the user, store reply in `var`
: literal text           # say (supports {var} substitution)
@agent prompt -> var     # call a named agent
!tool key=value -> var   # invoke a tool with kwargs
anything else            # forward to the default agent

See Stub compiler syntax for the full grammar.