summaryrefslogtreecommitdiff
path: root/src/core/parser.h
blob: d5143410ce5948dec4b317458b0ab92631924f30 (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
#ifndef SAND_PARSER_H
#define SAND_PARSER_H

#include "allocator.h"
#include "tokenizer.h"
#include "state.h"

typedef enum {
	SAND_AST_BINARY_OP,
	SAND_AST_NUMBER,
} SandAstKind;

typedef struct {
	SandToken op;
	struct _SandAst *left;
	struct _SandAst *right;
} SandAstBinaryOp;

typedef struct {
	SandToken value;
} SandAstNumber;

typedef struct _SandAst {
	SandAstKind kind;
	SandLocation location;
} SandAst;

SandAst *sand_parse(SandState *, SandAllocator *, const char *source, size_t source_length, const char *filename);

#endif