aboutsummaryrefslogtreecommitdiff
path: root/src/prc1/prv.h
blob: 945c7becb7b074670e0621920dc7ffaa93388d04 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef PRV_H
#define PRV_H

#include "lex.h"
#include <stddef.h>

struct prv;

struct step
{
    enum tktype type;
    const char *id;
};

struct pos
{
    const char *name;
    const struct seq *seq, *stseq;
    const struct step *step;
    int (*end)(const struct lex *, struct prv *);
};

struct prv
{
    const struct tk *tk, *stk, *id;
    struct tdconstant *tdc;
    struct storage *st;
    struct pos *pos;
    struct ast *ast;
    struct type *ag, *t;
    struct fn *proto;
    size_t n, i, block, cast;
    struct sym *s;
    int (*entry)(const struct lex *, struct prv *);
    int (*type)(const struct lex *, struct prv *p, const struct type *t);
    int (*sym)(const struct lex *, struct prv *, const struct sym *);
};

struct seq
{
    const struct step *steps;
    int (*fn)(const struct lex *l, struct prv *p);
};

int kw(const char *s);
int push(const struct pos *pos, struct prv *p);
int pop(const struct lex *l, struct prv *p);
void reset(struct prv *p);
char *sdup(const char *s);
const char *triplet(const struct prv *p);

#endif