diff options
| author | Xavier Del Campo Romero <xavi92@disroot.org> | 2026-05-09 02:56:07 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2026-05-17 11:13:23 +0200 |
| commit | 527c23b73c8dae16f02cca6f450edb7d8225f60f (patch) | |
| tree | 6b2bfd9e8d814026d6d2c1839d8cfe1bcadc825c /parse.h | |
| download | slcob-master.tar.gz | |
Diffstat (limited to 'parse.h')
| -rw-r--r-- | parse.h | 104 |
1 files changed, 104 insertions, 0 deletions
@@ -0,0 +1,104 @@ +#ifndef PARSE_H +#define PARSE_H + +#include "lex.h" + +struct u +{ + struct storage *storage; +}; + +struct s +{ + struct storage *storage; +}; + +union c +{ + unsigned long long uv; + long long v; +}; + +struct p +{ + int dummy; +}; + +struct t +{ + int dummy; +}; + +struct builtin +{ + const char *name; +}; + +struct type +{ + enum {U, S, C, P, T, BUILTIN} type; + const struct tk *tk; + size_t sz; + int sign; + + union + { + struct u u; + struct s s; + union c c; + struct p p; + struct t t; + struct builtin b; + } u; +}; + +struct param +{ + const struct tk *tk; + const struct stentry *entry; +}; + +struct pr +{ + const struct tk *tk; + struct param *params, *ret; + size_t nparams; +}; + +struct td +{ + const struct tk *tk; + struct type *types; + size_t ntypes; +}; + +struct fn +{ + const struct tk *tk; + enum linkage {EXTERNAL, STATIC} linkage; + struct storage *lk, *ws, *gl; + struct stmt *stmts; + struct pr *pr; + struct td *td; + size_t nstmts; +}; + +struct lit +{ + char *name; + const struct tk *tk; + const struct fn *fn; + struct lit *next; +}; + +struct ast +{ + struct fn *fns; + struct lit *lits, *lastlit; + size_t nfns, litcnt; +}; + +int parse(const struct lex *l, struct ast *ast); +void ast_free(struct ast *ast); + +#endif |
