spl 编写编译器基础框架 ai修复出现的stage2和stage3问题并提供新语法

This commit is contained in:
zzy committed 2026-11-07 21:52:02 +08:00
1 parent 126b979f72
commit 50ee126d44
87 files changed
+3168 -394

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
pub type Display = shape {
fn fmt(@Self self: *@self, out: @[*Sink]): bool;
};
pub type Debug = shape {
fn debug(@Self self: *@self, out: @[*Sink]): bool;
};
pub type Sink = shape {
fn write_byte(@Self self: *@self, byte: u8): bool;
// TODO shape default value for `fn write_bytes(@Self self: *@self, bytes: []const u8): bool;`
};
pub comptime fn Formatter(S: Sink): type {
ret struct {
out: S,
pub fn with_sink(out: S): @self {
ret .{ .out = out };
}
};
}