Browse Source

Minor bug fixes, removed object files

remotes/origin/HEAD
Seth Stubbs 6 months ago
parent
commit
1135e570bc
  1. 1
      .gitignore
  2. BIN
      bin/uxncle
  3. BIN
      bin/uxnscr
  4. BIN
      src/main.o
  5. BIN
      src/ulex.o
  6. 12
      src/uparse.c
  7. BIN
      src/uparse.o

1
.gitignore

@ -0,0 +1 @@
*.o

BIN
bin/uxncle

Binary file not shown.

BIN
bin/uxnscr

Binary file not shown.

BIN
src/main.o

Binary file not shown.

BIN
src/ulex.o

Binary file not shown.

12
src/uparse.c

@ -33,6 +33,13 @@ UASTNode *newNode(UParseState *state, UASTNodeType type, UASTNode *left, UASTNod
return node;
}
UASTNode *newNumNode(UParseState *state, UASTNode *left, UASTNode *right, int num) {
UASTNode *node = newNode(state, NODE_NUM, left, right);
node->num = num;
return node;
}
void errorAt(UToken *token, int line, const char *fmt, va_list args) {
printf("Syntax error at '%*s' on line %d", token->len, token->str, line);
vprintf(fmt, args);
@ -49,6 +56,9 @@ void error(UParseState *state, const char *fmt, ...) {
void advance(UParseState *state) {
state->previous = state->current;
state->current = UL_scanNext(&state->lstate);
if (state->current.type == TOKEN_ERR)
error(state, "unrecognized symbol '%*s'!", state->current.len, state->current.str);
}
int check(UParseState *state, UTokenType type) {
@ -83,7 +93,7 @@ const char* getNodeType(UASTNodeType type) {
UASTNode* number(UParseState *state, UASTNode *left, Precedence currPrec) {
int num = atoi(state->current.str);
return newNode(state, NODE_NUM, NULL, NULL);
return newNumNode(state, NULL, NULL, num);
}
UASTNode* binOperator(UParseState *state, UASTNode *left, Precedence currPrec) {

BIN
src/uparse.o

Binary file not shown.
Loading…
Cancel
Save