blob: 7ec4d2197c4c20053b483c8a96dbb9d281d09617 (
plain)
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
|
#ifndef _com_h
#define _com_h
typedef struct _compiler Compiler;
#include "state.h"
#include "chunk.h"
typedef struct {
char *name;
uint8_t slot;
} Local;
#define MAX_LOCALS 256
typedef struct _scope Scope;
struct _scope {
Scope *outer;
uint8_t nlocals;
Local locals[MAX_LOCALS];
};
struct _compiler {
State *S;
Chunk *ch;
int stack_cur;
Scope *scope;
};
Compiler compiler_new(State *S, Compiler *outer, Chunk *ch);
#define BYTECODE(C) (C->ch->bc)
#endif
|