SuperCode is a lean, fast systems programming language that compiles directly to x86-64 with zero external dependencies. Built for developers who want full control over their code without bloatware.
- 88 functions covering essential systems programming
- No garbage collection - direct memory control
- Single-file executable output (~100KB runtime)
- Direct x86-64 compilation via NASM and GCC
- Zero external dependencies (except pthread for threading)
- Mutexes, semaphores, condition variables
- Atomic compare-and-swap operations
- Lock-free primitives for concurrent code
- Go-style channels with bounded queues
- Thread pool with task distribution
- FIFO task scheduling
- BSD socket API (TCP/UDP)
- File I/O with POSIX semantics
- Memory mapping (mmap/munmap)
- Hardware I/O (port and MMIO access)
- Direct Linux syscall wrapper
- Interrupt control (enable/disable)
- Signature verification framework
- Benchmarking infrastructure
- PHP-style string manipulation
- Mathematical operations and bit manipulation
- Error handling framework
- Process/resource control
- Date/time operations
- Sorting and searching algorithms
supercode/
βββ src/ # Compiler source (lexer, parser, codegen)
βββ runtime/ # Runtime libraries (strings, math, sync, etc)
βββ include/ # Builtin function definitions
βββ builtin/ # Test suite (25 test files)
βββ scc # SuperCode compiler (ready to use)
git clone https://github.com/ahamedrashid-me/SuperCode.git
cd SuperCode
makeCreate hello.su:
fnc main[]::int {
show["Hello, World!\n"];
get[0];
}
Compile and run:
./scc hello.su -o hello
./hellofnc main[]::int {
str text = "hello world";
str upper = @upper[text];
str trimmed = @trim[text];
str substring = @substr[text, 0, 5];
int pos = @index[text, "world"];
str replaced = @replace[text, "world", "SuperCode"];
show[upper]; /* HELLO WORLD */
show[replaced]; /* hello SuperCode */
get[0];
}
fnc main[]::int {
int pool = @pool_create[4];
loop[int i = 0; i < 16; i = i + 1] {
@pool_submit[pool, 0, i];
}
@pool_wait[pool];
@pool_destroy[pool];
get[0];
}
fnc main[]::int {
int ptr = @alloc[1024];
@poke[ptr, 42]; /* Write to memory */
int value = @peek[ptr]; /* Read from memory */
@free[ptr];
get[0];
}
fnc main[]::int {
int sock = @socket[1, 0]; /* TCP socket */
@connect[sock, 127000001, 8080]; /* localhost:8080 */
int bytes_sent = @send[sock, buffer, 1024];
int bytes_recv = @recv[sock, buffer, 1024];
@close[sock];
get[0];
}
@len[str] - String length
@substr[str, pos, len] - Extract substring
@upper[str] - Uppercase
@lower[str] - Lowercase
@trim[str] - Remove whitespace
@split[str, delim] - Split into array
@join[arr, delim] - Join array
@index[str, substr] - Find position
@replace[str, old, new]- Replace all
@sqrt[x] - Square root
@pow[x, y] - Exponentiation
@abs[x] - Absolute value
@min[a, b] - Minimum
@max[a, b] - Maximum
@clz[x] - Count leading zeros
@alloc[size] - Allocate heap memory
@free[ptr] - Free memory
@realloc[ptr, size] - Reallocate
@peek[addr] - Read value
@poke[addr, value] - Write value
@memcpy[dst, src, len] - Copy memory
@memset[addr, val, len]- Fill memory
@mutex_create[] - Create mutex
@mutex_lock[id] - Lock
@mutex_unlock[id] - Unlock
@semaphore_create[count] - Create semaphore
@channel_create[size] - Create channel
@pool_create[workers] - Create thread pool
@socket[type, proto] - Create socket
@connect[sock, addr, p] - Connect
@send[sock, buf, len] - Send data
@recv[sock, buf, len] - Receive data
@fopen[path, flags] - Open file
@fread[fd, buf, len] - Read file
@fwrite[fd, buf, len] - Write file
@syscall[num, arg...] - Direct syscall
@fork[] - Create process
@exec[path, args] - Execute program
@exit[code] - Exit process
@sleep[ms] - Sleep
@clock[] - Get time
- GCC 7+
- NASM 2.14+
- Linux x86-64
make clean
makecd builtin
for test in t{1..25}_*.su; do
echo "Testing $test..."
../scc "$test" -o /tmp/test
/tmp/test
done| Phase | Functions | Tests | Status |
|---|---|---|---|
| 1: Sync | 14 | 2 | β Complete |
| 2: Concurrency | 10 | 2 | β Complete |
| 3: System I/O | 16 | 4 | β Complete |
| 4: Advanced | 4 | 1 | β Complete |
| 5: String/Math | 44 | 7 | β Complete |
| Total | 88 | 25 | β 92% |
- Lean & Fast - Minimal overhead, maximum control
- Zero Bloat - Only essential functionality
- Direct Compilation - NASM + GCC, no intermediates
- Systems Ready - Fork, sockets, syscalls, hardware I/O
- PHP-like Strings - Intuitive, easy string handling
- SYNTAX_REFERENCE.md - Complete language syntax guide
- builtin/BUILTIN_REFERENCE.md - Detailed function reference
- builtin/CHANNELS_THREADPOOL_API.md - Concurrency guide
- builtin/SYNC_API_REFERENCE.md - Synchronization API
fnc main[]::int {
show["Hello, World!\n"];
get[0];
}
fnc fib[int n]::int {
if[n <= 1] {
get[n];
} or {
get[fib[n - 1] + fib[n - 2]];
}
}
fnc main[]::int {
int result = fib[30];
show[result];
show["\n"];
get[0];
}
fnc main[]::int {
int pool = @pool_create[4];
loop[int i = 0; i < 100; i = i + 1] {
@pool_submit[pool, 0, i];
}
@pool_wait[pool];
@pool_destroy[pool];
show["All tasks done\n"];
get[0];
}
fnc main[]::int {
int server = @socket[1, 0];
@bind[server, 0, 8080];
@listen[server, 5];
show["Listening on port 8080\n"];
int client = @accept[server];
int bytes = @recv[client, buf, 1024];
@send[client, buf, bytes];
@close[client];
@close[server];
get[0];
}
- Threading functions require proper runtime linking
- Cryptographic functions are stubs (not implemented)
- No GUI/graphics support
- x86-64 Linux only
- No buffer overflow protection
- Direct memory access
- No type safety enforcement
- Use with caution in untrusted code
MIT License - See LICENSE file for details
Contributions welcome! Focus areas:
- Remaining 8 functions (8%)
- Cryptographic implementation
- Optimization passes
- Windows/macOS support
Rashid Ahmed - GitHub
- GitHub Issues: Report bugs and feature requests
- Documentation: See builtin/ directory for guides
- Examples: Check builtin/t*.su test files
SuperCode v0.2 - Lean systems programming without the bloat
π Repository: https://github.com/ahamedrashid-me/SuperCode