- A statically-typed language, custom compiler, and virtual machine — written entirely in C
Version: v0.3 “Spruce”
Status: Active Development
Determa is a full programming language built completely from scratch in C — including its own lexer, parser, type system, bytecode compiler, virtual machine, and garbage collector.
Designed as a capstone project for Theoretical Computer Science, Determa merges concepts from formal languages (DFA, CFG, Scope Theory) with practical systems implementation (interpreters, memory management, call stacks, symbol tables).
- High-performance tokenization
- Zero external dependencies
- Supports identifiers, keywords, integers, booleans, strings, operators, and punctuation
- Builds a complete Abstract Syntax Tree (AST)
- Implements full statement/expression grammar
- Supports:
- Variable declarations
- Blocks
- If / While
- Function declarations & calls
- Return statements
- Binary and unary operators
- Validates:
- Type consistency in expressions
- Variable usage and declarations
- Function signatures & arity
- Persistent Symbol Table
- Proper lexical scope checking (blocks, functions)
- Converts AST → custom bytecode instruction set
- Implements:
- Global & local variable access
- Arithmetic & logic ops
- Conditional jumps
- Loops
- Function call conventions
- Stack-based execution model
- Registers:
- Operand stack
- Call frames
- Instruction pointer
- OpCode support:
OP_ADD,OP_SUB,OP_MULTIPLY,OP_DIVIDE,OP_MODULOOP_GET_LOCAL,OP_SET_LOCALOP_GET_GLOBAL,OP_SET_GLOBALOP_CALL,OP_RETURNOP_JUMP,OP_JUMP_IF_FALSE,OP_LOOPOP_PRINT,OP_POP
- Deterministic function call model
- Correct stack unwinding + return value propagation
- Mark-and-Sweep GC
- Heaps manages:
- Strings
- Functions
- Future object types
- Safe during compilation (compiler roots marked)
- Interactive shell with persistent variables
- Execute
.detscripts directly - Optional parser-trace debug mode (PDA visualization)
Source Code
↓
Lexer (DFA)
↓
Parser (Recursive Descent → AST)
↓
Type Checker (Static Analysis)
↓
Compiler (Bytecode Generation)
↓
Virtual Machine (Stack-Based Execution)
↓
Output
# Windows
./build.batOutputs:
bin/determa.exe→ language runner + REPLbin/determa_test.exe→ full unit test suite
$ .bin\determa.exe
Determa v0.2 'Cedar'
> var x = 10;
> var y = 20;
> print x + y * 2;
Out: 50Executing examples/fibonacci.det
func fib(n) : int {
if n == 0 {
return 0;
} elif n == 1 {
return 1;
} else {
return fib(n - 1) + fib(n - 2);
}
}
print "Fibonacci Sequence (just fib(10)):";
print fib(4);Run:
$.bin\determa.exe examples/hello.det$ .bin\determa.exe --pda-debug
> 1 + 2;
PUSH: Expression
PUSH: Term
PUSH: Factor| Phase | Component | Status | Details |
|---|---|---|---|
| I | Lexer | ✅ Complete | DFA tokenizer |
| II | Parser | ✅ Complete | AST construction |
| III | Type Checker | ✅ Complete | Symbol tables, scopes |
| IV | Virtual Machine | ✅ Complete | Custom ISA & stack machine |
| V | Garbage Collector | ✅ Complete | Mark-and-sweep |
| VI | Control Flow | ✅ Complete | If, while, logical ops |
| VII | Functions | 🏗️ In Progress | Calls, local vars, returns |
| VIII | Closures | 🔜 Planned | Lexical captures |
- Language: C (C99)
- Architecture: Hand-written compiler + VM
- Dependencies: None (0 external libraries)
- Memory: Custom GC
- Design Inspiration: Wren, Lox, Lua, JVM bytecode
“Strong like the wood it's named after.”
Determa emphasizes:
- Clarity
- Predictability
- Theory-meets-systems design
- Fully self-implemented infrastructure
Andrew Fernandes
Feel free to ⭐ star the repository or reach out on LinkedIn!