Sscalascript.dev

a literate, typed, target-agnostic language

The source is a
document. The document
compiles.

ScalaScript makes Markdown structure real syntax — headings are scopes, fenced blocks are typed code — and lowers one source to the JVM, the browser, WebAssembly, Rust, Swift, and native.

greeter.ssc
---
name: greeter
targets: [jvm, js, wasm]
---

# greeter

This paragraph is part of the module.

```scalascript
def greet(name: String): String =
  s"Hello, $name!"

@main def run(): Unit =
  println(greet("world"))
```
---YAML front-matter — the module manifest & target list
# headinga namespace — headings open scopes you import by link
``` fencea typed unit — the code inside is checked, then compiled

how a file reads

Markdown is not decoration.
It is the grammar.

Every structural device you already use in a README carries meaning to the compiler. Nothing new to learn to start; the document you would have written is the program.

# Headingscope

Headings define namespaces

A section heading opens a named scope. Nesting headings nests scopes — structure in the prose is structure in the program.

[text](path)import

Links are references

A Markdown link resolves to an import or a cross-reference. The web of documents is the module graph.

``` blocktyped unit

Fences are typed code

A fenced block is a first-class, type-checked expression unit — Scala-flavored types, checked once at the IR.

${expr}splice

Prose can interpolate

Inline ${…} weaves evaluated values back into the text. Documentation and computation share one surface.

one source, many machines

Write once.
Emit everywhere.

Semantics and type-checking are defined a single time at the IR level. A backend is a translator, never a reinterpretation — so the same .ssc means the same thing on every target.

greeter.ssc  →  six backends

JVM Scala 3 JavaScript browser / Node WebAssembly WASI Rust native Swift SwiftUI Native VM self-hosted

beyond the basics

Typed algebraic effects,
with real handlers.

Effects and multi-shot delimited continuations are part of the language, checked in the type system and running the same across backends. Describe an effect, then decide what it means at the edge.

Self-hosted compiler · Apache-2.0
ask.ssc
effect Ask:
  def ask(): String

def program(): String =
  val name = Ask.ask()
  s"Hi, $name"

val result = handle(program()) {
  case Ask.ask(resume) => resume("Ada")
  case Return(x)          => x
}
println(result)  // Hi, Ada

in your terminal

Run a document.

One CLI takes a .ssc file straight to output, or packages it for a target. No project scaffold required to begin.

$ ssc run greeter.ssc
Hello, world!

$ ssc build-jvm greeter.ssc -o greeter.jar
wrote greeter.jar

$ ssc run --bytecode ask.ssc   # native VM lane
Hi, Ada