- All tests passing

- Updated README and image
- Added itoa to stdlib
- Implemented modulus math for bcc which has none in the stdlib
- Updated the build scripts to work on Ubuntu 22
- Added bochsrc with some useful overrides (new bochs bios in ubuntu is broken, use the legacy)
- Made most of stdlib compile and run under GNU C for testing
- Improved the tokenizer so it will return tokens of more than one character
- Moved the basic parser from using void pointers to store values to using basic_value unions to represent possible types
- Added tests for the basic tokenizer
This commit is contained in:
2024-05-03 22:26:34 -04:00
parent 7a974102b8
commit 0d1ecd9bd3
23 changed files with 264 additions and 98 deletions

View File

@@ -34,14 +34,27 @@
#define BASIC_TOKENIZER_MAX_LENGTH 512
#define BASIC_VARNAME_MAX_LENGTH 16
union basic_value {
char c;
int i;
unsigned int uint;
/* we don't handle floats yet. need to implement Fcomp, fpushf, fpushd.
* float f;
*/
char *str;
void *ptr;
};
typedef union basic_value basic_value;
struct basic_expr {
char type;
char lval_type;
char rval_type;
char pad;
void *lval;
void *rval;
basic_value lval;
basic_value rval;
};
typedef struct basic_expr basic_expr;
#define BASIC_VARFLAG_INIT 1
#define BASIC_VARFLAG_TINT 2
@@ -50,8 +63,9 @@ struct basic_expr {
struct basic_variable {
char *name;
char flags;
void *value;
basic_value value;
};
typedef struct basic_variable basic_variable;
#define BASIC_CONST_TRUE 1
#define BASIC_CONST_FALSE 0