Thagore is a statically-typed, compiled language that borrows Python-like indentation and brevity while targeting systems-level performance and safety. It uses strong type inference, offers flexible memory management (manual ownership or garbage collection), and ships with a single CLI tool named thagore. Thagore is a distinct language; Rust is only used to implement its compiler/runtime toolchain.
Current plan 💀🙏:
- Indentation-only blocks; no braces or
end. Scripts run top-to-bottom without amainwrapper. - Bindings:
=plus+= -= *= /= %=, and?=(assign only when the current value is falsy). - Expressions: numbers/booleans/
null, list[a, b], map{k: v}, arithmetic (+modon integers), comparisons (== != <> < > <= >=), logicaland/or/not, null-coalescing??, ternarycond ? a : b, optional chaining (expr?.field/expr?.method()),expr?assertions, andcopy/moveunary forms. - Functions: block or
func name(params) = expr; default parameters are allowed; method-call styleobj.method(args)passes the receiver first. - Control flow:
if/elif/else,match/case/default(first match wins; no fallthrough),while,for item in collection(orstart..endranges),break/continue(loops only),return,stopto halt the script. - Errors:
throwplustry/catch err(optionalfinally). - Imports:
use module.pathoruse module.path as alias, plusfrom module use name as aliasfor symbol imports. - Symbols from other modules are available via
from ... use ...oralias.method(...)only. - Strings: double-quoted basics; v-strings
v"..."interpolate{expr}with{{/}}; comments use//or/* ... */. - Truthiness: falsy values are
null,false, empty strings, andunit(no-return); all others are truthy. Type inference stays on by default.
// examples/hello.tg
func greet(name) = print(v"Hello {name}!")
name = input(v"Enter your name: ")
greet(name)
thagore run <file.tg>- read, parse, and execute a program.thagore init [<dir>]- scaffold a new Thagore project (configs, src/main.tg, test skeleton).thagore check <file.tg>- syntax/type/borrow validation without execution.thagore version- print the tool version.thagore update- update the thagore binary from a manifest URL.thagore fli-verify <metadata.tgc> [--lock-output out.ltgc]- validate Foreign Library Interface metadata (TGC) and emit an ABI hash (optionally writing a lock snippet in .ltgc).thagore lang [<en|vi>]- switch CLI messages for this invocation; if no value is provided, an interactive arrow-key picker is shown (fallback to English if no TTY).- Global
--lang <en|vi>flag works with any command to localize CLI/log messages (case-insensitive). - Global compatibility flags:
--language-version,--runtime-version,--stdlib-versionlet you target older language/runtime/stdlib versions; pipeline caches will invalidate if these change. - Module resolution flags:
--lib-path <path>(repeatable),--stdlib-path <path>,--trace-imports(shows origin + path),--print-resolve <spec>(prints resolve/chosen/origin). - Backends:
--backend vm(default),--backend wasm, or--backend cranelift(with the feature enabled). With Cranelift you can keep artifacts using--emit-obj(object file) and/or--emit-exe(linked native binary).
Drago also ships a minimal package manager binary named drago.
drago init- create.drago/,package.tgc, anddrago.lock.drago add axios- add a verified registry alias (or@user/pkg/github:user/repofor unverified).drago install- resolve dependencies, updatedrago.lock, and install into.drago/packages/.drago list- show installed packages (with--treeif desired).drago clean- clear cache and temp artifacts.drago pub- generatedrago.pubfor distribution.drago update- update the drago binary from a manifest URL.
Docs: docs/DRAGO.md, docs/registry.sample.json.
Update manifests:
THAGORE_UPDATE_MANIFESTenablesthagore update(and auto-update withTHAGORE_AUTO_UPDATE=1).DRAGO_UPDATE_MANIFESTenablesdrago update(and auto-update withDRAGO_AUTO_UPDATE=1).
Example usage:
drago init
drago add axios
drago add axios@^1.2.0
drago add user/repo
drago add github:user/repo
drago install
drago remove axios
drago list
drago clean
drago pub --name mylib --version 0.1.0Canonical core spec: docs/SYNTAX.md + docs/contracts.md.
src/main.rs- binary entrypoint; wires CLI to the pipeline.src/cli/- argument parsing and command dispatch (run,check,version).src/core/- shared types likeSourceCodeandZenResult.src/diagnostics/- unifiedZenErrorand error reporting helpers.src/fs/- filesystem helpers for loading.tgsources.src/lexer/- token definitions and an indentation-aware lexer (comments, strings, interpolation, numbers).src/parser/- AST + parser for core statements/expressions, imports, and OOP constructs.src/backend/- MIR lowering + runtime backends (VM/MIR, WASM, Cranelift).docs/OVERVIEW.md- detailed design and architecture notes.docs/contracts.md- canonical AST/MIR/span/module_key contracts and diagnostics rules (keep in sync with code).docs/SYNTAX.md- the up-to-date syntax reference for the core language (v-strings, range step, time counter).docs/OOP.md- Python-like OOP behavior (inheritance,__init__, bound methods).examples/- sample Thagore programs.tests/- integration tests for CLI flows.
finalclasses cannot be extended;sealedclasses only extendable inside the same module.- All bases must exist; unknown base classes are rejected.
overridemust match an existing base method or trait requirement (arity-checked); otherwise it is an error.- Non-abstract classes must implement all trait requirements with non-abstract methods.
- Abstract methods cannot be called; abstract/mixin types cannot be instantiated.
- The validator runs before codegen (VM/WASM/Cranelift) so CLI errors include spans for the offending method/class.
- Prebuilt (Windows):
dist/thagore-windows-x86_64.exe run examples/hello.tg - Install Rust (Cargo and
rustc) neu can build tu source. - Build:
cargo build - Run example:
cargo run -- run examples/hello.tg - Check example:
cargo run -- check examples/hello.tg - Tests:
cargo test - Bootstrap (optional):
cargo run --bin thagore -- run bootstrap/bootstrap.tg - Bootstrap (PATH):
thagore run bootstrap/bootstrap.tg(xemdocs/BOOTSTRAP.md; setTHAGORE_STAGE0neu binary stage0 khong trong PATH)
- Windows: install "Desktop development with C++" (or Build Tools) to get MSVC
link.exe, then install Rust viarustup(default stable MSVC toolchain). Verify withcargo --versionandrustc --version. - Linux: install build essentials (e.g.,
build-essential/gcc/clangpluspkg-configif needed) and Rust viarustup. - macOS: install Xcode command line tools (
xcode-select --install) and Rust viarustup. - After prerequisites, run
cargo buildandcargo teston each platform; the codebase avoids platform-specific APIs to stay portable like Python.
- Interpreter covers the full core snapshot above (bindings, control flow, collections, interpolation, try/catch/finally, stop/throw, optional chaining, match).
- Lexer is indentation-aware with comments/escapes/interpolation; parser/runtime keep expanding toward richer typing and the dual memory model. Standard modules will be written directly in Thagore and loaded with normal
use/import <module>(no embedded DSLs). - Planned keywords (
struct,borrow,borrowmut,gcnew,pyimport) are reserved but not implemented yet;copy/moveare reserved keywords with implemented semantics. - Runtime note: today the compiler/runtime and host stdlib are implemented in Rust; this is a conscious dependency for now and may be replaced or supplemented with other backends/runtimes in the future.
- Stdlib is split into a minimal auto-imported prelude and optional modules.
- Roadmap and module layout live in
docs/STDLIB_PLAN.md.
- GitHub Actions workflow at
.github/workflows/ci.ymlbuilds across Linux, macOS (Intel + Apple Silicon), and Windows for both AMD64 and ARM64 targets; Linux ARM64 usescross, native targets also run tests.
- Add GUIs
- Add classickeywords which add more remember keywords like print(), input() for beginners (this will become external library)