zig-lox icon indicating copy to clipboard operation
zig-lox copied to clipboard

Update to Zig 0.11

Open igorgue opened this issue 1 year ago • 2 comments

Tried to keep the same style you already have, no need to merge this, the only reason I did it was to study your implementation since I did mine in C but I want to write my own compiler in zig.

igorgue avatar Sep 05 '23 02:09 igorgue

This looks like nice work. Was zig fmt able to do a lot of this?

One problem: it looks to me like make test isn't actually running any tests. On main, with zig 0.10.1, the output of make test looks like

> make test
zig build --prefix '.'
zig run util/test.zig -- bin/lox `find test -name "*.lox" | grep -v test/benchmark | grep -v test/scanning | grep -v test/expressions | grep -v test/for/closure_in_body.lox `
test/closure/reuse_closure_slot.lox
test/closure/assign_to_shadowed_later.lox
...
test/block/scope.lox

Passed: 244, Failed: 0

On this branch, I see

> make test
zig build --prefix '.'
zig build test -- bin/lox `find test -name "*.lox" | grep -v test/benchmark | grep -v test/scanning | grep -v test/expressions | grep -v test/for/closure_in_body.lox `

Notice the missing test file names and passed/failed summary.

jwmerrill avatar Sep 06 '23 14:09 jwmerrill

@jwmerrill the type changes from return @intToEnum(Precedence, @enumToInt(self) + 1); to return @as(Precedence, @enumFromInt(@intFromEnum(self) + 1)); were done by zig fmt (well I have it to run on save in my editor).

I'll check the tests today, since I don't have zig 0.10 I thought it was okay to not output anything, I'm new to zig too.

igorgue avatar Sep 06 '23 14:09 igorgue