A lightweight, performant programming language that compiles to C.
File Extension: .do | Compiler: doc | Language Server: do-lsp
- Simple, intuitive syntax inspired by modern languages
- Compiles to C for maximum performance with -O2 optimization
- Minimal runtime overhead
- Interactive REPL for rapid development
- Full IDE support via LSP and Tree-sitter
- Functions with parameters and recursion
- Variables with
let - Control flow:
if/else,whileloops,forloops - Arrays: implicit memory pointers via
[val1, val2],len(arr),push(arr, val) - Rich operators: arithmetic, comparison, logical
- Built-in I/O with
print() - Comments with
#
- Completion - Functions, variables, keywords, snippets
- Go to Definition - Jump to symbol definitions
- Find References - Find all usages
- Hover - Type information and documentation
- Signature Help - Function parameter hints
- Rename - Symbol renaming across files
- Diagnostics - Real-time error detection
- Code Actions - Quick fixes and refactorings
- Code Lenses - Reference counts
- Formatting - Auto-format code
# Build compiler
./build.sh
# Set up development environment
./setup-dev.sh
# Launch IDE
./ado-edit example.do
# Or compile and run directly
./doc example.do
# Interactive REPL
./doc# Comment
fn factorial(n) {
if n <= 1 {
return 1
}
return n * factorial(n - 1)
}
fn main() {
print("Factorial of 10:", factorial(10))
let i = 0
while i < 10 {
print(i)
i = i + 1
}
return 0
}./build.sh# Run a file
./doc example.do
# Interactive REPL
./doc
# Run file then enter REPL
./doc -i example.doquit- Exit REPLhelp- Show available commandsclear- Clear the current buffer
Run the setup script for a complete IDE experience:
./setup-dev.sh
./ado-edit example.doThis launches Neovim with:
- LSP server (completion, diagnostics, go-to-definition)
- Tree-sitter syntax highlighting (if installed)
- Auto-formatting
- Symbol renaming
| Key | Action |
|---|---|
gd |
Go to definition |
gD |
Go to type definition |
gr |
Find references |
K |
Show hover info |
<leader>rn |
Rename symbol |
<leader>f |
Format document |
<leader>ca |
Code actions |
<C-k> |
Signature help |
[d / ]d |
Navigate diagnostics |
fn name(params) { body }let name = valueif condition { } else { }
while condition { }return valueprint(expr1, expr2, ...) # Print values- Arithmetic:
+,-,*,/,% - Comparison:
==,!=,<,>,<=,>= - Logical:
and,or,not
- Integers:
42,-10 - Booleans:
true,false - Strings:
"hello\nworld"
# Single line commentSee the examples/ directory:
example.do- Comprehensive feature democollatz.do- Collatz sequence calculatormath.do- Math functionsconditionals.do- Conditional expressions
Source (.do) → Lexer → Parser → AST → Codegen → C → Binary
↓
LSP Server
.
├── doc # Compiler binary
├── build.sh # Build script
├── setup-dev.sh # IDE setup script
├── ado-edit # Neovim launcher
├── main.c # Main entry point
├── lexer.c/h # Lexer
├── parser.c/h # Parser
├── codegen.c/h # Code generator
├── lsp/
│ └── do-lsp.py # Language server
├── nvim/
│ └── init.lua # Neovim config
├── tree-sitter-do/ # Tree-sitter grammar
├── vim/ # Vim syntax files
└── examples/ # Example programs
Ado compiles to optimized C code with -O2, running at near-native speed. The generated C code is clean and readable.