Patch #276: Direct System Access: Linux x86_64 Syscalls and Networking in Wave

We are pushing the boundaries of what Wave can do at the system level. This latest patch introduces a comprehensive suite of Linux x86_64 syscall wrappers and foundational networking modules, giving developers direct control over the operating system.
1. The Full Linux x86_64 Syscall Suite
We have established a robust low-level interface for the Linux kernel. By utilizing our advanced inline assembly, we’ve implemented a complete set of syscall wrappers:
syscall0throughsyscall6: Supporting the standard x86_64 calling convention, these functions allow Wave to trigger any Linux kernel service directly.System Infrastructure (
std::sys::linux):fs: Native wrappers for file operations likeopen,read,write,lseek, and even directory management.memory: Manual virtual memory management is now possible viammap,munmap, andbrk.time: High-precision time handling withnanosleepandclock_gettime, including fullTimeSpecsupport.socket: Raw wrappers and constants (likeAF_INET,SOCK_STREAM) that serve as the building blocks for all network communication.
2. High-Level Networking: std::net
While raw syscalls provide power, our new std::net module provides productivity. We have built high-level, synchronous abstractions on top of the raw socket API:
TCP Support: With
TcpListenerandTcpStream, you can now build robust servers and clients in Wave.UDP Support: The
UdpSocketmodule is available for fast, datagram-based communication.
These modules make network programming in Wave feel modern and safe while maintaining the performance of the underlying system calls.
3. Compiler Intelligence: "Syscall Coercion"
To make low-level programming less tedious, we’ve introduced a specialized compiler feature. The backend now performs implicit coercion between Pointers and Int64 specifically for functions prefixed with syscall.
This allows you to pass raw memory addresses directly to syscalls without manually casting them to integers every time—a common pain point in systems programming that Wave now handles elegantly.
4. Lexer & Parser Enhancements
The frontend has also received significant updates to support binary data and better code hygiene:
Hex Escape Sequences: String literals now support
\xHH(e.g.,"\x01\x02\x03"), which is essential for defining binary protocols and packet headers.Trivia Cleanup: We refactored whitespace and comment skipping into a unified
skip_triviamethod. This ensures that multi-line comments and complex formatting are handled more robustly during tokenization.Input Statement: The parser now supports the
inputstatement, rounding out our basic I/O capabilities.
5. Backend Refinements
We’ve fine-tuned the LLVM codegen to handle character data more precisely. When generating scanf format strings, 8-bit integers (i8) are now correctly mapped to %c, ensuring perfect compatibility between Wave’s char types and the standard I/O library.
Why This Matters
With this patch, Wave is no longer just a language for logic; it’s a language for systems. You can now write a web server, manage file systems, or even build a custom memory allocator entirely in Wave, without relying on external C libraries for basic system tasks.
We are excited to see the low-level tools and network services the community will build with these new primitives!




