summaryrefslogtreecommitdiff
path: root/src/sys/np
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-10-01 17:08:06 -0400
committerIan Moffett <ian@osmora.org>2025-10-01 17:08:44 -0400
commite0f16855cb1e5f0465db13405b6524682847688c (patch)
tree20bcc76aea8665b3862eb59338ac0b956274d395 /src/sys/np
parent8c8d31ed2c4127ba2965bd6a40ff0293418bc1e2 (diff)
np: parse: Add AST structure and initial logic
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/np')
-rw-r--r--src/sys/np/core/np_parse.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/sys/np/core/np_parse.c b/src/sys/np/core/np_parse.c
index 12732cd..63f93aa 100644
--- a/src/sys/np/core/np_parse.c
+++ b/src/sys/np/core/np_parse.c
@@ -33,6 +33,7 @@
#include <sys/param.h>
#include <np/lex.h>
#include <np/parse.h>
+#include <np/ast.h>
#include <os/np.h>
#define pr_trace(fmt, ...) printf("pirho.parse: " fmt, ##__VA_ARGS__)
@@ -173,6 +174,13 @@ parse_work(struct np_work *work)
return -EINVAL;
}
+ /* Get the AST root node */
+ work->ast_root = ast_alloc(work);
+ if (work->ast_root == NULL) {
+ pr_error("failed to alloc root AST|n");
+ return -ENOMEM;
+ }
+
while (error == 0) {
error = lex_nom(work, &tok);
if (error < 0) {