aboutsummaryrefslogtreecommitdiff
path: root/src/prc1/print.h
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2026-10-01 01:04:30 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2026-10-11 00:14:35 +0200
commit4ce39e4fc1de9536de7dedfe91b6dee38dec76ae (patch)
treef9820f96b8eab624430c3700f32a2878a7036ee2 /src/prc1/print.h
parent9140988be4e5bb028b7140aca1a67af1370c72a7 (diff)
downloadprc-4ce39e4fc1de9536de7dedfe91b6dee38dec76ae.tar.gz
WIP sym + cgen
Diffstat (limited to 'src/prc1/print.h')
-rw-r--r--src/prc1/print.h25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/prc1/print.h b/src/prc1/print.h
index 950e0bc..061ead4 100644
--- a/src/prc1/print.h
+++ b/src/prc1/print.h
@@ -3,24 +3,31 @@
#include "cgen.h"
#include "lex.h"
+#include "prv.h"
#include <stddef.h>
-struct prientry
+struct prisym
{
- const struct tk *tk;
- const struct lit *lit;
- const struct stentry *entry;
+ enum {PRS_LIT, PRS_NAM, PRS_STR, PRS_PTR, PRS_NUM} type;
+ const struct sym *s;
+
+ union
+ {
+ const struct lit *lit;
+ const struct stentry *e;
+ const char *name;
+ } u;
};
struct print
{
- struct prientry *entries;
- size_t nentries;
- int println;
+ struct prisym *syms;
+ size_t nsyms;
+ int skipln;
};
-int print(const struct lex *l, struct prv *p,
- int (*fn)(const struct lex *, const struct prv *, const struct print *));
+int print(const struct lex *l, struct prv *p);
+int print_cgen(const struct print *pr, struct cgen *c, const char *f);
void print_free(struct print *p);
#endif