diff --git a/CHANGELOG.md b/CHANGELOG.md index b9983b2..8c27bd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,5 +34,6 @@ Now in Zig! - [x] Parse minimal expression - [x] Parse minimal variable binding - [x] Parse minimal statement +- [x] Parse minimal module diff --git a/build.zig b/build.zig index 32db097..545b718 100644 --- a/build.zig +++ b/build.zig @@ -40,6 +40,7 @@ pub fn build(b: *std.Build) void { .target = target, .optimize = optimize, }); + syntax_module.addImport("lexic", lexic_module); exe.root_module.addImport("syntax", syntax_module); // This declares intent for the executable to be installed into the @@ -92,9 +93,6 @@ pub fn build(b: *std.Build) void { const files = [_][]const u8{ "src/01_lexic/root.zig", "src/02_syntax/root.zig", - "src/02_syntax/variable.zig", - "src/02_syntax/expression.zig", - "src/02_syntax/statement.zig", }; for (files) |file| { const file_unit_test = b.addTest(.{ diff --git a/src/02_syntax/statement.zig b/src/02_syntax/statement.zig index 9aebc1a..b356c5b 100644 --- a/src/02_syntax/statement.zig +++ b/src/02_syntax/statement.zig @@ -68,6 +68,7 @@ test "should parse a variable declaration statement" { switch (statement.value) { .variableBinding => |v| { try std.testing.expectEqual(true, v.is_mutable); + try std.testing.expectEqualDeep("my_variable", v.identifier.value); }, } } diff --git a/src/main.zig b/src/main.zig index 119fa90..db496db 100644 --- a/src/main.zig +++ b/src/main.zig @@ -31,5 +31,8 @@ fn repl() !void { const tokens = try lexic.tokenize(line, alloc); defer tokens.deinit(); + var module_ast: syntax.Module = undefined; + try module_ast.init(&tokens, 0, alloc); + try bw.flush(); }