Harding is a Smalltalk dialect written in Nim that preserves most of the distinguishing features of the Smalltalk language while fitting in with modern tooling and strong abilities to integrate with libraries from the Nim and C ecosystems. The language currently has a stackless AST based interpreter supporting green threads in classic Smalltalk style.
"Hello, World!" println
# Class with generated accessors
Person := Object derivePublic: #(name age)
p := Person new
p name: "Alice"
p age: 30
("Hello, " , p name) println
# Class with generated accessors and a manual method
Point := Object derivePublic: #(x y)
Point>>distanceFromOrigin [ ^ ((x * x) + (y * y)) sqrt ]
p := Point new
p x: 3; y: 4
p distanceFromOrigin println # Prints: 5.0Install libraries gtk4 gtksourceview5
apt-get install gtk4 gtksourceview5 libvte-2.91-gtk4-devbrew install gtk4 gtksourceview5 pkg-configgit clone https://github.com/gokr/harding.git
cd harding
nimble harding # Build harding REPL
nimble bona # Build bona IDE (optional)
# Optional: build with MummyX HTTP server support
nimble harding_mummyx
nimble bona_mummyxBinaries:
harding- REPL/interpreterharding_debug- REPL with debugger supportharding-lsp- Language Server for IDE supportgranite- Compiler to Nimbona- GTK IDE
Optional MummyX-enabled builds expose HTTP server support through lib/mummyx/Bootstrap.hrd.
See docs/MUMMYX.md.
For proper dock and Alt-Tab icons:
nimble install_bona # Installs .desktop file and iconharding # Interactive REPL
harding script.hrd # Run a file
harding script.hrd -- a b # Pass runtime args to System arguments
harding -e "3 + 4" # Evaluate expression
harding --ast script.hrd # Show AST, then execute
harding --loglevel DEBUG # Verbose execution traceLaunch the graphical IDE:
bona # Start IDE with LauncherIDE Tools:
- Launcher - Main window with access to all tools
- Workspace - Code editor with Do It (Ctrl+D), Print It (Ctrl+P), Inspect It (Ctrl+I)
- Terminal - Embedded VTE terminal for shell and agent workflows
- Transcript - Output console for logging and results
- System Browser - Browse classes by library (Core, Collections, GUI, IDE)
- Inspector - Examine object slots and values
On Linux, the embedded terminal requires the VTE development/runtime packages for your GTK version. Bona's default GTK4 build uses libvte-2.91-gtk4-dev.
The terminal supports a right-click context menu plus shortcuts such as Ctrl+Shift+C, Ctrl+Shift+V, Ctrl+Shift+N, and Ctrl+Shift+O for copy, paste, new terminal, and a new OpenCode terminal.
Script files are automatically wrapped in a block, enabling Smalltalk-style temporary variable declarations:
# script.hrd
| counter total |
counter := 0
total := 0
1 to: 5 do: [:i |
counter := counter + 1
total := total + i
]
total # Returns 15Scripts execute with self = nil, following the Smalltalk workspace convention.
Build with MummyX support when you want Harding-side HTTP routing:
nimble harding_mummyx
./harding examples/mummyx_hello.hrdThis optional integration is also available in Bona builds:
nimble bona_mummyxSee docs/MUMMYX.md for the API, build tasks, and concurrency model.
HARDING_HOME- Default home directory for loading libraries
Full IDE support for .hrd files with syntax highlighting, completions, and debugging:
# Build the extension
nimble vsix
# Install
code --install-extension vscode-harding/vscode-harding-0.4.0.vsixFeatures:
- Syntax highlighting
- Code completions (LSP)
- Hover information (LSP)
- Go to definition (LSP)
- Breakpoints and stepping (DAP)
- Variable inspection (DAP)
See VSCODE.md for full details.
What feels familiar:
- Message syntax: unary
obj size, binary3 + 4, keyworddict at: key put: value - Cascade messages
- Classes and class methods
- String concatenation with comma:
"Hello" , " World" - Blocks are proper lexical closures with temporaries and can do early returns:
[ | temp | temp := 1 ] - Everything is an object, everything happens via message sends
- Live evaluation in the REPL with
harding - Collection messages:
do:,select:,collect:, etc.
What's different:
| Smalltalk | Harding |
|---|---|
| Required period end-of-statement | Optional - newline or period both work |
| Double quotes for comments | Hash # for comments |
| Single quotes for strings | Double quotes for strings |
| Classes define structure via class definition | Class construction using derive: Object derive: #(slots) |
| Manual accessor definition | Generated accessors via derivePublic: or derive:read:write: |
| Image-based persistence | Source files loaded on startup, git friendly source format, normal Unix workflow |
| VM execution | Interprets AST directly, native compiler via Nim (in development) |
| FFI via C bindings | Direct Nim interop: call Nim functions, use Nim types |
Harding distinguishes globals from locals by capitalization and enforces this in parsing:
| Type | Convention | Example |
|---|---|---|
| Globals (class names, global variables) | Uppercase first | Point, MyGlobal |
| Locals (slots, temporaries, parameters, block params) | Lowercase first | temp, index, value |
| Feature | Harding Syntax |
|---|---|
| Comments | # This is a comment |
| Strings | "Double quotes only" |
| Create subclass | Point := Object derive: #(x y) |
| Create with generated accessors | Point := Object derivePublic: #(x y) |
| Create instance | p := Point new |
| Define method | Point>>move: dx [ ... ] |
| Batch methods | Point extend: [ self >> foo [ ... ] ] |
Working:
- Lexer, parser, stackless AST interpreter
- Class-based object system with slots
- REPL with file execution
- Block closures with lexical scoping and support for early returns
- Data structure literals
- Method definition (
>>),selfandsupersupport - Multi-character operators (
==,//,<=,>=,~=,~~) - Standard library (Object, Boolean, Block, Number, Collections, String, Exception, TestCase)
- Core I/O and process helpers (
File,FileStream,System,Stdin/Stdout/Stderr) - Green threads:
Processor fork:,Processor yield - Synchronization primitives: Monitor, SharedQueue, Semaphore
- Optional MummyX HTTP server integration with
HttpServer,Router, and green-process request handlers - Multiple inheritance with conflict detection and scoped super send
- Dynamic message sending:
perform:,perform:with: - Generated accessors via
derivePublic:,derive:read:write:, andderive:read:write:superclasses: - Named slot and binding access via
:: - Library/namespace system for modular code organization (Core, Collections, GUI, IDE libraries)
- External Harding libraries via the
harding libworkflow, including BitBarrel as an installable package - String concatenation with auto-conversion using
, - GTK-based IDE (
bona) with Workspace (code editor with Do It/Print It/Inspect It), Transcript (output console), System Browser (class/method browser), and Inspector (object viewer) - Smalltalk-style Print It - insert results in editor with selection
- Exception handling via
on:do:with Smalltalk-style resumable exceptions (resume,resume:,retry,pass,return:) - Granite compiler pipeline for standalone
.hrdscripts to native binaries via Nim - Granite support for inline control flow, block-heavy examples, and mixed interpreted/compiled runtime support
- Version-based MIC/PIC caching for improved message send performance
- Broad test coverage across interpreter, stdlib, compiler, exceptions, IDE tooling, and website examples
- VSCode extension with LSP (completions, hover, symbols) and DAP (breakpoints, stepping, variables)
- Harding Debug Protocol (HDP) for VM debugging
In progress:
- Granite parity work for remaining inheritance and in-VM compilation edge cases
- FFI to Nim
- Standard library and external ecosystem expansion
- Quick Reference - Syntax quick reference
- Language Manual - Complete language manual
- Implementation - VM internals
- Bootstrap - Bootstrap architecture and stdlib loading
- Tools & Debugging - Tool usage
- Compilation Pipeline - Granite compiler architecture
- Nim Package Tutorial - Bundle Nim primitives with
.hrdsources - Roadmap - Active priorities and milestones
- Performance - Performance workflow and priorities
- Future Plans - Long-term roadmap
- CLAUDE.md - Developer guide and repository conventions
- GTK Integration - GUI development
- VSCode Extension - VSCode editor support
- GtkSourceView - Gedit/GNOME Text Editor syntax highlighting
harding examples/hello.hrd
harding examples/classes.hrd
harding examples/blocks.hrd
harding examples/process_demo.hrd
harding examples/inheritance.hrd
harding examples/collections.hrd
harding examples/control_flow.hrd
# Launch the GTK IDE
bonaSee the examples/ directory for more examples covering arithmetic, variables, objects, classes, methods, inheritance, collections, control flow, and blocks.
MIT
Smalltalk's semantics, modern implementation.