Refactored the C files out into libraries, started work on the BASIC repl (it can sorta do math!)

This commit is contained in:
2015-01-25 22:05:28 -08:00
parent 977285b8aa
commit 208c831c79
13 changed files with 560 additions and 234 deletions

39
src/basic.h Normal file
View File

@@ -0,0 +1,39 @@
#ifndef _BASIC_H_
#define _BASIC_H_
#define BASIC_MATH_ADD 1
#define BASIC_MATH_SUB 2
#define BASIC_MATH_MUL 3
#define BASIC_MATH_DIV 4
#define BASIC_MATH_MOD 5
#define BASIC_LVAL_EXPR 0
#define BASIC_LVAL_VAR 1
#define BASIC_RVAL_EXPR 2
#define BASIC_RVAL_VAR 3
#define BASIC_RVAL_CONST 4
#define BASIC_FOUND_LVAL 0x0001
#define BASIC_FOUND_RVAL 0x0002
#define BASIC_ERR_SYNTAX_MULTIPLE_LVALUES 1
#define BASIC_ERR_SYNTAX_TOKEN_LENGTH 2
#define BASIC_ERR_SYNTAX_GENERAL 3
#define BASIC_ERR_SYNTAX_MULTIPLE_RVALUES 4
#define BASIC_TOKENIZER_MAX_LENGTH 512
struct basic_math_expr {
char type;
char lval_type;
char rval_type;
char pad;
void *lval;
void *rval;
};
extern int basic_errno;
void run_basic(void);
#endif /* _BASIC_H_ */