diff --git a/selfhost/parser.n b/selfhost/parser.n index e17a712..1e9b000 100644 --- a/selfhost/parser.n +++ b/selfhost/parser.n @@ -36,6 +36,9 @@ const NodeType = enum(u8) { // payload: list of branch nodes (1 - 2 in list, true cond first) @"if", + // payload: loop body + @"loop", + // payload: lhs // idx - 1: rhs // token is the binary operator @@ -293,6 +296,11 @@ fn parse_primary_expression(context: *ParserContext) u32 { node_payload.get(result).* = branch_builder.head; return result; } + else if(p == .loop_keyword) { + const result = context.add_advance(.@"loop"); + node_payload.get(result).* = parse_block(context); + return result; + } else if(p == .@"{") { const result = add_with_token(context.current_token, .block); node_payload.get(result).* = parse_block(context);