lang
The directory represents the multilingual core of the Talon voice-programming suite. It contains language-specific subdirectories that map spoken English to syntax-appropriate commands, formats, operators, and constructs across dozens of programming languages and markup formats.
The Architecture of Talon Language Support
At its core, this directory utilizes a decoupled architecture where generic, high-level voice intents are separated from concrete, language-specific syntactic rules.
[ Voice Input: "state if" ]
│
▼
[ tags/imperative.talon (Core) ]
│
▼
[ user.code_insert_if_statement() ]
│
┌──────────────────────┼──────────────────────┐
▼ ▼ ▼
[ python/python.py ] [ scala/scala.py ] [ go/go.py ]
(Output: "if :") (Output: "if () {}") (Output: "if {}")
The system behaves as follows:
- Global Abstractions: The tags directory defines a collection of "tags," abstract actions, and generic list stubs (e.g., math operators, control flow statements).
- Context Matching: When you open a file, Talon inspects the file extension or buffer type and asserts a context like
code.language: pythonorcode.language: rust. - Language Activation: The target language directory matches this context. Its
.talonfiles activate the relevant generic tags, configure local formatters (such as CamelCase or snake_case), and bind language-specific keywords. - Syntax Translation: The language’s accompanying
.pyscript overrides the parent's abstract actions, generating the precise symbols, brackets, and keywords for that specific programming language.
Core Abstraction Engine
- tags: This is the foundation of the voice-coding system. It contains the declaration of common programming structures (loops, declarations, OOP namespaces, comments, and exceptions) and acts as the router. It defines the central Language Operators Framework, mapping abstract math, assignment, bitwise, pointer, and array index requests to language-specific output strings. It also includes an on-screen Common Functions IMGUI picker, letting users quickly pick, call, or wrap expressions in high-frequency built-in functions.
Static, Compiled, and Systems Languages
Languages with rigorous type systems, pointers, and memory-management paradigms require specialized syntactic construction.
- c & cpp: These subdirectories handle pointer syntax (
*,&), memory allocators, and preprocessor macros (#include,#ifdef). cpp features specialized formatting for references, template brackets (<T>), and captures that prefix names with the C++ standard library namespace (std::). - rust: Overrides standard null-safety controls with
Option-based patterns (Some,None,.is_none()). It also manages complex pattern matching (e.g.,if let Some(...)), macro signatures (println!,vec!), and supports "turbofish" (::<>) generation. - go: Configures capitalized visibilities (CamelCase settings) and provides rapid shortcuts for Go’s idiomatic error checking (
if err != nil). It also handles channel operators and numeric type generation. - java, csharp, kotlin, & scala: These directories handle class-based structures, access modifiers (
public,private,protected), and generic collections. scala integrates functional paradigm arrows (->and<-) and subtype boundaries, while java manages boxed vs. primitive types.
Web and Scripting Ecosystems
Web-focused languages use loose types, flexible formatting, and highly dynamic structures.
- javascript & typescript: These manage JavaScript, TypeScript, and React frameworks (
JSXandTSX). typescript layers typed boundaries, const assertions (as const), and type aliases over basic ES6 capabilities. - html & css: Enable rapid front-end layout development. html scopes tags to markup environments, while css features property declarations, custom CSS properties/variables (
var(--)), and specialized layout math units. - python: Maps commands to Python structures (such as
try/exceptblocks and decorators) and enforcesSNAKE_CASEstyling. It includes a custom capture engine that synthesizes complex type hinting arrays (e.g., translating "list of string or integer" intolist[str | int]). - php & ruby: These handle web application scripting. php automates dollar-sign (
$) variables, member accessors (->), and error-handling blocks. ruby implements block parameter pipes (| |) and conditional assignment (||=).
Data, Infrastructure, and Special-Purpose Environments
This group covers tools for databases, statistics, functional programming, and automation.
- sql: Tailor-made for relational database querying. It overrides standard comparison operators (e.g., using
=and<>instead of==and!=), manages nulls viaIS NULL, and configures standard SQL aggregate functions. - terraform: Speeds up infrastructure-as-code authoring using HashiCorp Configuration Language (HCL). It contains helpers for resource blocks, data blocks, and common terraform-specific property keys.
- r & stata: Built to run statistical computations. r features pipe operators (
%>%) and a dictionary matching spoken inputs to hundreds of Tidyverse, Shiny, and ggplot2 procedures. stata configures Stata packages and cluster variance commands. - elixir: Implements Elixir’s concurrency, pattern-matching blocks, module definitions, and functional pipelines (
|>). - proto: Designed for writing Protocol Buffers schema files, providing quick types and field assignment identifiers.
- vimscript & batch: Simplify shell scripting. vimscript provides scoping prefix captures (such as global
g:and script-locals:scopes) to facilitate configuration editing. - markdown: Enables structured document authoring by mapping commands directly to nested lists, header levels (
#), hyperlinking templates, and code fences.
Self-Referential Tooling
- talon: A unique meta-programming module that allows you to write Talon voice commands using your voice. It reads Talon's own runtime registry to auto-generate a spoken vocabulary of every active Action, Capture, Mode, App, and Setting on your system. It also formats templates identically whether you are modifying a
.talonfile or writing custom context blocks inside a Talon.pyextension.