diff options
| author | Xavier Del Campo Romero <xavi92@disroot.org> | 2026-10-01 01:04:30 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2026-10-11 00:14:35 +0200 |
| commit | 4ce39e4fc1de9536de7dedfe91b6dee38dec76ae (patch) | |
| tree | f9820f96b8eab624430c3700f32a2878a7036ee2 /src/prc1/div.c | |
| parent | 9140988be4e5bb028b7140aca1a67af1370c72a7 (diff) | |
| download | prc-4ce39e4fc1de9536de7dedfe91b6dee38dec76ae.tar.gz | |
WIP sym + cgen
Diffstat (limited to 'src/prc1/div.c')
| -rw-r--r-- | src/prc1/div.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/prc1/div.c b/src/prc1/div.c index 9061ac6..7236a71 100644 --- a/src/prc1/div.c +++ b/src/prc1/div.c @@ -1,4 +1,5 @@ #include "div.h" +#include "fn.h" #include "gl.h" #include "im.h" #include "lk.h" @@ -6,8 +7,8 @@ #include "td.h" #include "ws.h" -static const struct seq linkage = - {(struct step[]){{ID, "linkage"}, {0}}, .fn = lk}, +static const struct seq + linkage = {(struct step[]){{ID, "linkage"}, {0}}, .fn = lk}, types = {(struct step[]){{ID, "types"}, {0}}, .fn = td}, imports = {(struct step[]){{ID, "imports"}, {0}}, .fn = im}, procedure = {(struct step[]){{ID, "procedure"}, {0}}, .fn = pr}; @@ -42,9 +43,9 @@ int div_fn(const struct lex *l, struct prv *p) { struct pos init = { + .name = __func__, .seq = fnseq, - .stseq = fnseq, - .step = fnseq->steps + .end = fn_end }; if (push(&init, p)) @@ -58,32 +59,38 @@ int div_im(const struct lex *l, struct prv *p) { struct pos init = { + .name = __func__, .seq = imseq, - .stseq = imseq, - .step = imseq->steps }; - if (lex_eof(l, p->stk)) - return 0; - else if (push(&init, p)) + if (push(&init, p)) return -1; p->stk = p->tk; - return 1; + return 0; +} + +static int endp(const struct lex *l, struct prv *p) +{ + if (fn_end(l, p)) + return -1; + + p->proto = NULL; + return 0; } int div_p(const struct lex *l, struct prv *p) { struct pos init = { + .name = __func__, .seq = pseq, - .stseq = pseq, - .step = pseq->steps + .end = endp }; if (push(&init, p)) return -1; p->stk = p->tk; - return 1; + return 0; } |
