Initial commit

This commit is contained in:
2026-08-23 11:11:36 +03:00
commit 0548f8de26
97 changed files with 20841 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
const std = @import("std");
pub const Token = struct {
text: []const u8,
};
pub fn lex(
allocator: std.mem.Allocator,
source: []const u8,
) !std.ArrayList(Token) {
var tokens: std.ArrayList(Token) = .empty;
var iterator = std.mem.tokenizeAny(
u8,
source,
" \t\r\n",
);
while (iterator.next()) |word| {
try tokens.append(
allocator,
.{
.text = word,
},
);
}
return tokens;
}