Peios Learn
Documentation

Peios

Peios Peios Kernel Universal Directory Project

Developer Tools

Trail Acta Provium clackatoo CAF GCSL Pekit

Applications

Framewright

Standards and Conventions

Standards and Conventions Peios Specifications
GCSL

Getting Started

Single-page view · as markdown

GCSL

GCSL / Getting Started

GCSL is a statically typed scripting language. A program can describe a configuration record, compute a value, or run commands. You use the same expressions for all three, with function types separating pure computation from operations that can change the outside world.

The gcsl command runs programs, checks them without execution, formats source files, and serves editor requests. Starting it without a command opens an interactive read-evaluate-print loop (REPL).

Values first #

A file is a block of declarations and expressions. Named fields form its resulting record. This configuration computes one field from another:

name = "gcsl"
version = "0.1.0"
archive = "{name}-{version}.tar.gz"

A file can instead return one expression. Use let for private values that don't become fields of a record. The checker catches incompatible types and unresolved names before any part of the program runs.

Execution and trust #

Pure functions use : before their result type. Impure functions use ->; they can run processes, access files, and await deferred work. Memoized functions use ->> and reuse results within an execution context. A lazy expression delays work until it is awaited. It doesn't start a background task.

GCSL's type system is not a sandbox. Running a script gives its process and file operations the permissions of the process running GCSL. Check an unfamiliar program with gcsl check before deciding whether to run it. Checking does not establish that executing it is safe.

Where to go next #

Start with Running a First Program, then read Values and Bindings. Use gcsl(1) for the command interface, gcsl(5) for language rules, and gcsl-stdlib(3) for standard functions.

Pekit embeds GCSL to provide its own build interface. Its definitions and commands belong to Pekit. The separate tree-sitter-gcsl repository owns its editor grammar and queries; the compiler parser in this repository is the authority for whether a GCSL program is accepted.

Running a First Program

GCSL / Getting Started

You can run a single GCSL file without creating a workspace. This example checks a small configuration and prints its computed description.

Before you start #

You need the following:

  • The gcsl executable on your command search path.
  • A writable directory for the example file.

Create and run the file #

  1. Save the following text as hello.gcsl:

    let component = {name = "gcsl"; version = "0.1.0"}
    "{component.name} {component.version}"
    
  2. Check the file without running it:

    gcsl check hello.gcsl
    
  3. Run the file:

    gcsl run hello.gcsl
    

Check the result #

The check reports no problems in 1 file checked on standard error. The run prints the string contents on standard output:

gcsl 0.1.0

A file whose result is {}, the empty record, prints nothing. Diagnostics go to standard error. See gcsl(1) for exit statuses and output modes.

Trying expressions interactively #

Run gcsl without arguments to open the REPL. Enter let n = 21, then n * 2 on the next line. The second line prints 42 : Int. Each input is one line; separate several items on that line with semicolons. Press Ctrl+D to leave the session.

Peios Learn — documentation for Peios software.

Built with Trail.