Dijk 0.0.5 — experimental / educational development release. Grammar, ABI, standard library, compiler compatibility, and runtime behavior are all still unstable. See CHANGELOG.md.
Dijk is an educational programming language designed to teach programming and systems concepts from first principles, while remaining capable of scaling into practical application development through Dijk+.
Dijk
├── Dijk Core
│ └── foundational language and compiler
│
└── Dijk+
└── application-development environment
Dijk Core is the foundational profile: a small, low-level language whose implementation teaches how a language and its compiler are actually built.
✓ Project foundations (charter, philosophy, architecture, roadmap)
✓ Lexical analysis (dijk lex, .dk and .dijk source files)
✓ Parsing (dijk parse)
✓ AST (dijk ast)
✓ Semantic analysis: name resolution, lexical scopes, and immutable bindings
✓ Static type checking (dijk check, dijk check --types): i32, i64, bool, string
✓ Interpretation (dijk run): a tree-walking interpreter, for well-typed programs
□ Memory model
□ Intermediate representation
□ Native compilation
0.0.5 gives Dijk a static type system. dijk check takes a program
through every stage up to type checking (lex → parse → semantic
analysis → type checking) without running it, and dijk run runs only
programs that pass. A mistake like 1 + true, which 0.0.4 found only
at run time, is now a type error found before anything executes (see
docs/types.md). Variables are immutable unless declared
let mut, and integers are i32 or i64, at compile time and at run
time alike. It is still intentionally small: there are no conversions
between types, no print, and no compiler yet. See docs/ for
the philosophy, design constraints, architecture, and roadmap that
govern implementation.
Language
↓
Lexer
↓
Parser
↓
Semantic Analysis
↓
Interpreter
↓
Type System
↓
IR
↓
Compiler
↓
Runtime
↓
Standard Library
↓
Dijk+
↓
Real Application
↓
Self-hosting
- docs/philosophy.md — the core educational principle
- docs/language.md — initial design constraints and feature boundary
- docs/architecture.md — compiler architecture: the pipeline, what exists, what's planned
- docs/roadmap.md — provisional implementation phases
- docs/lexer.md — lexical grammar implemented by
dijk lex - docs/parser.md — grammar and parsing strategy implemented by
dijk parse - docs/ast.md — the AST shape, parse-tree-vs-AST, invariants, and traversal
- docs/semantic.md — semantic analysis: name resolution, lexical scopes, mutability, and semantic errors
- docs/types.md — the static type system: types, typing rules, inference, return paths, diagnostic codes, and
dijk check - docs/interpreter.md — the execution model: values (
i32/i64), environments, call frames, return propagation, runtime errors, anddijk run - docs/testing.md — automated tests and manual CLI testing
- CHANGELOG.md — what shipped in each release
Requires a Rust toolchain (stable). From this directory:
cargo build
cargo run -- --version
cargo run -- --help
cargo run -- doctor
cargo run -- lex examples/hello.dk
cargo run -- parse examples/hello.dk
cargo run -- ast examples/hello.dk
cargo run -- check examples/add.dk
cargo run -- check --types examples/add.dk
cargo run -- run examples/factorial.dk
cargo testSee docs/testing.md for the full manual-testing workflow, including sample fixtures for every token category and error case.
Or build once and use the binary directly:
cargo build --release
./target/release/dijk --version # Linux/macOS
.\target\release\dijk.exe --version # Windows PowerShellFor a file hello.dk containing fn main() { let x: i32 = 42; }:
dijk lex hello.dk
FN
IDENTIFIER("main")
LPAREN
RPAREN
LBRACE
LET
IDENTIFIER("x")
COLON
IDENTIFIER("i32")
EQUAL
INTEGER("42")
SEMICOLON
RBRACE
EOF
dijk parse examples/hello.dk
Program
└── Function
├── Name: main
├── Parameters: []
├── Return type: i32
└── Body
├── Let
│ ├── Name: x
│ ├── Type: i32
│ └── Value
│ └── Integer(42)
├── Let
│ ├── Name: y
│ ├── Type: i32
│ └── Value
│ └── Binary(+)
│ ├── Identifier(x)
│ └── Integer(10)
└── Return
└── Identifier(y)
dijk ast prints the same tree plus a node-count summary:
1 function(s), 3 statement(s), 5 expression(s)
dijk run executes a program and prints the value its main returns:
dijk run examples/factorial.dk
fn factorial(n: i32) -> i32 {
if n <= 1 {
return 1;
}
return n * factorial(n - 1);
}
fn main() -> i32 {
return factorial(5);
}
120
dijk check takes a program through every stage up to type checking,
without running it:
$ dijk check examples/add.dk
Checking examples/add.dk...
Lexical analysis OK
Parsing OK
Semantic analysis OK
Type checking OK
Program is well-typed.
and dijk check --types then shows what the type checker learned: each
function's signature, and the type of every variable it declares:
fn add(a: i32, b: i32) -> i32
a : i32 (1:8)
b : i32 (1:16)
result : i32 (2:9)
fn main() -> i32
A program that is well-formed but meaningless, or whose operations do not fit its types, is rejected before it runs, and a problem that only appears while running is reported with the call stack at that moment:
$ dijk run examples/semantic_error.dk
semantic error: unknown identifier `y`
--> examples/semantic_error.dk:8:12
|
8 | return y;
| ^
$ dijk run examples/type_error.dk
type error[E0001]: type mismatch
--> examples/type_error.dk:2:18
|
2 | let x: i32 = "hello";
| ^^^^^^^
= expected `i32`
= found `string`
$ dijk run examples/runtime_error.dk
runtime error: division by zero
--> examples/runtime_error.dk:2:16
|
2 | return a / b;
| ^
note: call stack: divide ← main
There is no dijk compile yet.
See CONTRIBUTING.md.
Apache-2.0. See LICENSE.