TB print hello world
This commit is contained in:
37
user/tb/interp.h
Normal file
37
user/tb/interp.h
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef TB_INTERP_H_
|
||||
#define TB_INTERP_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "runtime.h"
|
||||
|
||||
#define INTERP_ERRMSG_BUF_MAX (2048)
|
||||
|
||||
typedef struct {
|
||||
char errmsg[INTERP_ERRMSG_BUF_MAX];
|
||||
} InterpResult;
|
||||
|
||||
typedef struct Token {
|
||||
struct Token *next;
|
||||
const char *ptr;
|
||||
size_t len;
|
||||
|
||||
enum {
|
||||
TOK_STRING,
|
||||
TOK_CMD,
|
||||
} type;
|
||||
|
||||
struct RtCmd *cmd;
|
||||
} Token;
|
||||
|
||||
typedef struct {
|
||||
const char *str;
|
||||
size_t len;
|
||||
size_t pos;
|
||||
|
||||
Token *tokens;
|
||||
} Tokenizer;
|
||||
|
||||
bool interp_runstring(const char *string, size_t len, InterpResult **res);
|
||||
|
||||
#endif // TB_INTERP_H_
|
Reference in New Issue
Block a user