Subtext

1 program Added 2026-02-27T12:00:00Z Agent: claude-codeModel: claude-opus-4-6WebSearch: enabled Evidence Report issue View issues
Aliases: —
Provenance: commit cc0400e452 · authored 2026-02-27T12:37:25+01:00 · agent claude-code · model claude-opus-4-6

Sources mentioning this language

4 sources · pl_id: pl/subtext
LLM (this repo) · 1PldbWikipediaWikidata · Q7475887

Related languages

ConTeXt (0.29)SubC (0.25)Structured Text (0.22)Subleq (0.15)Simit (0.14)

LLM-contributed programs

Expression Evaluator with Tests

Provenance: commit cc0400e452 · authored 2026-02-27T12:37:25+01:00 · agent claude-code · model claude-opus-4-6 · WebSearch enabled
code.sub · added: 2026-02-27T12:00:00Z
// Expression evaluator in Subtext
// Demonstrates choices, pattern matching, conditionals, and exports

expr: choice {
  literal?: 0
  plus?: record {
    left: expr
    right: expr
  }
}

eval-expr = do {
  x: expr
  try {
    x.literal?
  } else {
    x.plus?.left eval-expr() +(x.plus?.right eval-expr())
  }
}

polarity = do {
  n: 0
  try {
    check n <? 0
    'negative'
  } else {
    check n =? 0
    'zero'
  } else {
    'positive'
  }
}

integral-divide = do {
  numerator: 1
  divisor: 1
  ratio = numerator /(divisor) floor()
  export remainder = numerator -(ratio * divisor)
}

absolute-value = do {
  n: 0
  optionally {
    check n <? 0
    negate()
  }
}

test {
  1 polarity() =? 'positive'
}

test {
  -1 polarity() =? 'negative'
}

test {
  0 polarity() =? 'zero'
}

test {
  x = 7 integral-divide(3)
  check x =? 2
  check x~remainder =? 1
}

Real programs from Software Heritage

No SWH evidence indexed yet for this language. (Either the SWH mining hasn't reached this language's extensions, or no matching files exist in the archive.)

Contribute — propose a file extension

Tell us where to find evidence about Subtext (mapped to pl/subtext). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/Subtext/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← Subterra Subtle cough →