Lexical structure

Comments and statement separators: the two most basic rules of XS source text.

Summary

Line comments start with --; block comments use {- and -} and nest correctly, so you can comment out code that already contains block comments. Shebang lines (#!/usr/bin/env xs) are silently ignored. Statements are separated by newlines or semicolons; both forms work anywhere, including inside blocks.

Canonical

-- line comment (everything after -- is ignored)

{- block comment (nestable: {- inner -} works fine) -}

#!/usr/bin/env xs   -- shebang line, silently ignored by the interpreter

Block comments nest properly, so you can comment out code that already has block comments in it.


Newlines and semicolons both separate statements.

let a = 1
let b = 2

let x = 10; let y = 20; let z = x + y

-- semicolons inside blocks
if true { let p = 1; let q = 2 }

-- extra semicolons are fine
let val = 42;;;