Closed Emmett81 closed 11 months ago
Second commit with full out-of-order implementation added.
I was unable to write a test file for the "converge" error. So I included converge.asm
as an example. For future reference, the original version did not detect when there was no convergance on output size. So it was rewritten.
@hlorenzi I found an (for me) unexpected converge error case for the new combined fix. I haven't investigated it fully. But if in both asm{} and global space the labels are referenced out-of-order for the instruction being evaluated. And a global scope label involved has the same name as another global identifier. Then it seems to throw a converge error.
@hlorenzi I found an (for me) unexpected converge error case for the new combined fix.
I was partially wrong in what triggers it. This a minimal example.
{
emit {x} => x`8
call => asm {
;ret:
emit ret
emit andme
ret:
}
} ;andme: call andme:
I'll unfortunately close this for now since the assembler has received a complete infrastructure overhaul, and this PR can't be easily merged as is.
A label can only be used after it's defined, so no out-of-order support yet. Every line inside an asm{} that starts with TokenKind::Identifier && TokenKind:Colon is filtered out. The label name parsed and added via info.args(.set_label) with it's value set to the current instruction address.