The lambda-st runtime and the VSCode extension (.vsix) are provided free of charge to partner companies that have signed an NDA; they are not publicly distributed. Please get in touch before evaluating.
Your First Surgery
Create find_todos.st:
"Extract all TODO comments from source code"
| grammar source matches |
grammar := Grammar from: '
todo: "TODO" /[^\\n]*/
%ignore /./
'.
source := File read: 'target.js'.
matches := Grammar findAll: grammar in: source.
matches do: [:m |
(m at: 'text') displayNl.
].
Run it:
lambda-st run find_todos.st
You just performed code surgery. No regex wrestling, no AST libraries - just declare the pattern and extract.
Note the doubled backslash in /[^\\n]*/. A string literal reads \n as a real line feed - one of five escapes (\n \r \t \0 \\) Lambda Smalltalk reads for affinity with C, the shell, JSON and regex - and a grammar rule ends at a line feed, so a single backslash would cut the rule in half. \\n hands the grammar the two characters \ and n, which is what the regex wants. Every other backslash (\w, \d, \s) passes through untouched, and regexMatches: and the other regex messages take '[^\n]*' as written - it is the grammar lexer that needs the doubling. The other two places to double are a Windows path ('C:\temp' holds a tab) and a regex matching a backslash ('\\\\'). See String Literals in the API reference.
VSCode Extension
Full IDE support for serious work:
- Syntax highlighting - TextMate grammar
- Language Server (LSP) - Diagnostics, hover info
- Debugger (DAP) - Breakpoints, step execution, variable inspection
Setup
- VSCode: Extensions → "..." → "Install from VSIX..."
- Select the
lambda-smalltalk-x.x.x.vsixfile
The extension auto-detects lambda-st-lsp and lambda-st-dap in your workspace or PATH.
Debugging
- Open a
.stfile - Click line gutter to set breakpoints
- F5 to start debugging
- Step through, inspect variables, evaluate expressions
Library and Plugin Search Paths
When you use Module import: or Plugin load:, Lambda Smalltalk searches these locations in order:
| Priority | Path | Description |
|---|---|---|
| 1 | Current directory | ./lib/Text/Text.st |
| 2 | Executable directory | Where lambda-st is installed |
| 3 | LAMBDA_ST_LIB_PATH | Custom library paths |
| 4 | LAMBDA_ST_PLUGIN_PATH | Custom plugin paths |
Environment variables use ; as separator on Windows, : on Unix.
Example: If you install Lambda Smalltalk to C:\lambda-st\, the bundled libraries at C:\lambda-st\lib\ are automatically found.
Module import: 'Text'. "Loads lib/Text/Text.st"
Plugin load: 'excel_plugin'. "Loads plugins/excel_plugin.dll"Next Steps
- Code Surgery - The main event
- Modules - Namespaces, imports, and what
export:enforces - API Reference - All built-in classes