Implement parsing
This commit is contained in:
27
lib/include/parse.h
Normal file
27
lib/include/parse.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef PARSE_H
|
||||
#define PARSE_H
|
||||
|
||||
#include "am.h"
|
||||
#include "store.h"
|
||||
#include "token.h"
|
||||
|
||||
#define PARSE_MAX_DEPTH 128U
|
||||
|
||||
typedef enum {
|
||||
PARSE_STATE_INIT,
|
||||
PARSE_STATE_LIST,
|
||||
PARSE_STATE_DONE,
|
||||
PARSE_STATE_ERROR,
|
||||
} parse_state_t;
|
||||
|
||||
typedef struct {
|
||||
am_t *am;
|
||||
store_t *store;
|
||||
parse_state_t state;
|
||||
parse_state_t *sp, stack[PARSE_MAX_DEPTH];
|
||||
} parse_ctx_t;
|
||||
|
||||
void parse_init(am_t *am, store_t *store, parse_ctx_t *out);
|
||||
parse_state_t parse_proc(parse_ctx_t *ctx, const token_t *token);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user