Embedded programming language for Zig
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Documentation changes

IamPyu 1af9fa31 d3608b4d

+5 -4
+5 -4
src/lang.zig
··· 3 3 const Allocator = std.mem.Allocator; 4 4 const Arena = std.heap.ArenaAllocator; 5 5 6 - const SliceIterator = @import("./util.zig").SliceIterator; 7 - 6 + /// Runtime error 8 7 pub const RuntimeError = error{ 9 8 InvalidFunction, 10 9 FunctionFail, ··· 90 89 /// A pair of values 91 90 pub const Cons = struct { car: *Value, cdr: *Value }; 92 91 93 - /// An iterator of values 92 + /// An iterator for `Value` 93 + /// 94 + /// Is prone to infinite loops due to lists that reference themselves. 94 95 pub const Iter = struct { 95 96 current: ?*Value, 96 97 ··· 745 746 746 747 /// Evaluate the AST of a program 747 748 pub fn evalAst(self: *Self, ast: []const *Value) RuntimeError!*Value { 748 - var iter = SliceIterator(*Value).init(ast); 749 + var iter = @import("./util.zig").SliceIterator(*Value).init(ast); 749 750 var value: ?*Value = null; 750 751 while (iter.next()) |expr| : (value = try self.evalExpr(expr)) {} 751 752 return value orelse try Value.initNil(self);