This document defines the initial design constraints for Dijk Core. It is deliberately not a full language specification — that will be written incrementally, alongside the implementation, as each construct is designed and built.
Statically typed
Compiled
General purpose
Systems-oriented
Educational
Extensible
Cross-platform
Dijk Core syntax should be familiar rather than novel:
fn add(a: i32, b: i32) -> i32 {
return a + b;
}
Syntax is intentionally not considered a primary research contribution of this project. Time is better spent on the mechanisms syntax describes than on inventing punctuation.
A Dijk source file uses either extension:
.dk short form, for everyday use
.dijk long form, unambiguous
Both name the same language; every command (dijk lex, dijk parse,
dijk ast, dijk check, dijk run, and later dijk build, ...)
accepts either. .dk is expected to be the convention used in
practice; .dijk exists for contexts where .dk alone would be
ambiguous or where the fuller name is preferred.
Dijk Core initially targets:
- primitive types
- variables
- expressions
- control flow
- functions
- arrays
- structs
- enums
- references/pointers
- basic memory operations
- modules
- basic I/O
- HTTP
- databases
- web frameworks
- package ecosystem
- async/await
- advanced generics
- macros
- GUI
- IDE
These may eventually be addressed by Dijk+ or dijk-stdlib, built on top of
Core rather than folded into it.
Covers:
- booleans
- integers
- floating-point values
- characters
- arrays
- structs
- enums
- references/pointers
- functions
Deferred to later, once the above is well understood:
- generics
- traits/interfaces
- advanced inference
- algebraic data types
- ownership-related typing
Of the initial scope, dijk-0.0.5 implements booleans and the integers
i32 and i64 (plus strings, and unit for functions that return
nothing), with strict compatibility: no implicit conversions between
types. See docs/types.md.
Dijk Core prioritizes educational transparency over an immediately sophisticated safety model:
Explicit memory
↓
Understand memory bugs
↓
Understand why safety abstractions exist
↓
Introduce safer abstractions
An ownership/borrowing model may be investigated later, but it is not a requirement for the initial language.
The feature boundary above is a target. What Dijk Core implements today is much smaller:
- A program is one or more functions, and it starts running at
fn main(), which takes no parameters (docs/parser.mdhas the grammar).mainmay return a value of any type, whichdijk runprints. - Every value has a static type:
i32,i64,boolorstring, plusunitfor "no value". Types are checked before the program runs (dijk check, and as part ofdijk run), and a program with a type error never runs. There are no implicit conversions: ani32is never accepted where ani64is expected, and there is no cast yet (docs/types.md). - Integer literals are
i32unless their context expects ani64. Integer arithmetic is checked: a result that does not fit in its type is a runtime error, never a silent wrap-around. Strings have no escapes. - Variables are declared with
let, and their type is inferred from the initializer or written as an annotation (let x: i64 = 0;). A variable is immutable unless declaredlet mut; only alet mutmay be assigned to, and only with a value of its own type. Variables are lexically scoped: a block's variables end with the block, an inner block may shadow an outer variable, and one scope may not declare the same name twice (docs/semantic.md). - Control flow is
if/elseandwhile, whose conditions must bebool. - Functions declare the type of every parameter, and their return type
with
-> T; without it they returnunit. A function with a return type must return a value on every path. Parameters are immutable, and arguments are passed by value. Functions may recurse (docs/interpreter.md).
This is a living document that will grow as each construct above is actually designed and implemented. It should never grow ahead of the implementation it describes.