feat: support unary negation, let/const statements, and expand std syscalls #271
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces the unary negation operator (
-) to allow negative expressions beyond just literals, integratesletandconstinto the statement parser, and significantly expands the standard library with low-level Linux syscalls and networking capabilities. These updates bridge the gap between high-level language ergonomics and low-level system programming.Key Changes
1. Unary Negation Support (
-)The compiler now supports negating any numeric expression, not just constant literals (e.g.,
-(a + b)).Operator::Negand updated type inference logic to ensure negation applies to numeric types while the logical NOT (!) operator correctly yields a boolean.-prefix for general expressions.0 - xlogic for integers (build_int_sub) and0.0 - xfor floats (build_float_sub).2. Parser Enhancements
letandconstkeywords into the statement parsing loop. This allows for immutable local bindings and constant declarations in a way that matches industry-standard syntax.3. Standard Library (std) Expansion
std/sys/linux/syscall.wave. This module leverages Wave's inline assembly to implement thesocketsyscall directly.std/net/udp.wave, providing a higher-level abstraction for creating UDP sockets using the underlying syscalls.std/libc/c.waveas a foundational module for maintaining C ABI compatibility and FFI documentation.std/manifest.jsonto register the newsys,net, andlibcnamespaces.