Skip to main content

Module script

Module script 

Source
Expand description

Script mode for running .seq files directly

Enables .seq files to run directly with shebangs:

#!/usr/bin/env seqc
: main ( -- Int ) "Hello from script!" io.write-line 0 ;

Running seqc script.seq arg1 arg2 or ./script.seq (with shebang) will:

  1. Detect script mode (first arg is a .seq file)
  2. Compile with -O0 for fast compilation
  3. Cache compiled binary (keyed by source + include hashes)
  4. Run cached binary or compile -> cache -> run
  5. Pass remaining argv to the script

Functionsยง

compute_cache_key
Compute cache key from source + all transitive includes
get_cache_dir
Get cache directory: $XDG_CACHE_HOME/seq/ or ~/.cache/seq/
run_script
Run a .seq script (compile if needed, then exec)