Assemble kernel on the client #1

Merged
cdo merged 72 commits from client-side-assembler into main 2026-03-18 15:21:33 +00:00
Showing only changes of commit 46a571be93 - Show all commits

19
asm.js
View File

@@ -754,9 +754,15 @@ class Parser {
*handle(src) {
let action;
for (const token of this.tokenizer.handle(src)) {
if (action = this.handlers[this.state](token)) {
yield action;
const handler = this.handlers[this.state];
if (handler == undefined) {
console.error(`ERROR: Unhandled state ${this.state}`);
this.state = State.TOP;
continue;
}
if (action = handler(token))
yield action;
}
}
}
@@ -955,8 +961,13 @@ export class Assembler {
push(chunk) {
const text = this.decoder.decode(chunk, { stream: true });
for (const action of this.parser.handle(text))
this.handlers[action.type](action);
for (const action of this.parser.handle(text)) {
const handler = this.handlers[action.type];
if (handler == undefined)
console.error("ERROR: Unhandled action", action);
else
handler(action);
}
}
lookup_block(symbol) {