You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
828 B
C

7 years ago
#ifndef PARSER_H_
#define PARSER_H_
#include "variable.h"
7 years ago
#include <stdint.h>
7 years ago
typedef struct {
variable *vars;
char **names;
uint32_t *stack;
uint32_t stidx;
char **lines;
uint32_t lnidx;
variable *ret;
uint8_t indent;
uint8_t sindent;
} instance;
7 years ago
#define SKIP (1 << 7)
typedef int (*func_t)(instance *);
instance *inewinstance(void);
void idelinstance(instance *it);
7 years ago
int idoline(instance *it, const char *s);
variable **iparse(instance *it, const char *s);
variable *isolve(instance *it, variable **ops, uint32_t count);
void inew_cfunc(instance *it, const char *name, func_t func);
7 years ago
variable *make_varf(variable *v, float f);
variable *make_vars(variable *v, const char *s);
7 years ago
uint32_t ipop(instance *it);
void ipush(instance *it, uint32_t v);
variable *igetarg(instance *it, uint32_t n);
7 years ago
#endif // PARSER_H_