CLI reference

The langoost binary is the entry point for everything. (During development you can substitute go run . for ./langoost.)

./langoost run <file.goost>      Execute a .goost script
./langoost repl                  Interactive REPL (Ctrl+D to exit)
./langoost server [flags]        Start the persistent HTTP execution server
./langoost disasm <file.goost>   Print disassembled bytecode
./langoost version               Print version

run

Compile and execute a script:

$ ./langoost run hello.goost
Hello, world!

Add --debug to enable debug logging (the logging.debug level) during the run:

$ ./langoost run --debug hello.goost

repl

Start an interactive session that evaluates one line at a time:

$ ./langoost repl
> let x = 21
> print(x * 2)
42

server

Run as a long-lived execution server. The process stays warm and serves requests with no cold start:

$ ./langoost server --port 8080
FlagDefaultDescription
--port8080Port to listen on
--timeout30sMax execution time per request
--dir.Directory to search for .goost files

disasm

Print the compiled bytecode for a script — useful for understanding what the compiler produces:

$ ./langoost disasm examples/math.goost

=== examples/math.goost (16 instructions) ===
0000 [   3] CONST                #0 (<fn add/2>)
0001 [   3] DEF_GLOBAL           #1 (add)
...
=== add (6 instructions) ===
0000 [   4] LOAD_LOCAL           slot=0
0001 [   4] LOAD_LOCAL           slot=1
0002 [   4] ADD
0003 [   4] RETURN

Error messages

Runtime and compile errors include the file name and line (and column for lex/parse errors):

main.goost:12: undefined variable "x"
main.goost:7: function "add" expects 2 arguments, got 3
main.goost:3: array index 5 out of bounds (len=3)
script.goost:4:12: expected }, got EOF

For how the pipeline fits together, see architecture.