A rudimentary lisp-like language
lisp
1//! TODO: Parsing functionality. Intentionally separate from lexing.
2const std = @import("std");
3
4const lex = @import("lex.zig");
5
6pub fn parse(allocator: std.mem.Allocator, lexemes: std.ArrayList(lex.Lexeme)) !Ast {
7 _ = allocator;
8 _ = lexemes;
9 return error.Todo;
10}
11
12// TODO: AST
13// the AST will be a flat array(list?) of nodes, indexed by a handle type. nodes that contain other
14// nodes will merely contain these handles.
15
16pub const Ast = struct {
17 nodes: std.ArrayList(Node),
18
19 pub const Node = union(enum) {
20 pair: struct { car: Handle, cdr: Handle },
21 boolean: bool,
22 number: f64,
23 symbol: []const u8, // TODO: interning!
24 string: []const u8, // TODO: interning?
25 inert,
26 ignore,
27
28 pub const Handle = enum(u32) { _ };
29 };
30};