diff --git a/compiler.c b/compiler.c index ce2687f..676d37d 100644 --- a/compiler.c +++ b/compiler.c @@ -459,7 +459,7 @@ variable_declaration(Symbol *def) if(def) { List_push(arena, def->args, variable, sizeof(Symbol)); } else { - emitter->emit_type(arena, code, variable, parser->depth); + emitter->emit_type(arena, code, variable, variable->scope); parser->current_type = st; } } else { @@ -478,7 +478,7 @@ variable_declaration(Symbol *def) if(match(TOKEN_EQ)) { emitter->emit_set_value(arena, code); expression(); - emitter->emit_constant(arena, code, variable, parser->depth); + emitter->emit_constant(arena, code, variable, variable->scope); } consume(TOKEN_SEMICOLON); @@ -939,7 +939,7 @@ number(void) case SYMBOL_BYTE: case SYMBOL_U8: case SYMBOL_I8: - emitter->emit_char(arena, code, parser->previous.start, + emitter->emit_byte(arena, code, parser->previous.start, parser->previous.length); break; default: diff --git a/docs/SPECIFICATION.org b/docs/SPECIFICATION.org index 990300a..591dde1 100644 --- a/docs/SPECIFICATION.org +++ b/docs/SPECIFICATION.org @@ -25,6 +25,7 @@ It is short for "Undarsċieppan" The name comes from the Proto-West-Germanic wor | Type | Description | |------+-----------------------------------| | =byte= | Character (architecture specific) | +| =char= | Character (architecture specific) | | =u8= | exactly 8-bit unsigned int | | =i8= | exactly 8-bit signed int | | =u16= | exactly 16-bit unsigned int | @@ -45,7 +46,7 @@ The following is a list of global operators and their effect: - // - comment -- //* */ +- /* */ - block comment - ! - not diff --git a/emit/uxn/emit.c b/emit/uxn/emit.c index c5e52c3..09b66c9 100644 --- a/emit/uxn/emit.c +++ b/emit/uxn/emit.c @@ -804,7 +804,7 @@ void uxn_emit_byte(Arena *a, List *out, const char *str, i32 length) { u8 i = (u8)strtol(str, nil, 10); - sprintf(uxn_temp_strbuf, "#%04x ", i); + sprintf(uxn_temp_strbuf, "#%02x ", i); StrBuf_append(a, out, uxn_temp_strbuf); USED(length); } diff --git a/test/array.ul b/test/array.ul index 143e806..2a8bdfe 100644 --- a/test/array.ul +++ b/test/array.ul @@ -1,7 +1,9 @@ nat[6] fixed_size = [1, 2, 3, 4, 5, 0]; -fixed_size[5] = 6; +if (!fixed_size[5]) { + fixed_size[5] = 6; +} nat i = 0; while (i < fixed_size.length) {