<feed xmlns='http://www.w3.org/2005/Atom'>
<title>tools.nes/lib/xixanta/src/parser.rs, branch main</title>
<subtitle>Tools for NES/Famicom development.
</subtitle>
<id>https://git.mssola.com/nes/tools.nes/atom?h=main</id>
<link rel='self' href='https://git.mssola.com/nes/tools.nes/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/'/>
<updated>2026-08-18T14:39:37Z</updated>
<entry>
<title>Add global labels</title>
<updated>2026-08-18T14:39:37Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-08-18T14:39:37Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=fcd4c9a267b407e653ed6b21ae87f219f3e4c4af'/>
<id>urn:sha1:fcd4c9a267b407e653ed6b21ae87f219f3e4c4af</id>
<content type='text'>
These are labels that are declared by prefixing a '#' symbol to the
name, and it allows the label to be declared at the global scope instead
of the current one.

This is a feature which is not to be abused so to not make scopes
pointless, but it can be quite handy with some optimizations while not
abandoning scopes completely.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Add support for the asan:fixed-segments comment</title>
<updated>2026-07-09T20:14:22Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-07-09T20:07:47Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=6f58e4ab8d90166cac4e4da269a77c5134f12f1e'/>
<id>urn:sha1:6f58e4ab8d90166cac4e4da269a77c5134f12f1e</id>
<content type='text'>
This magic comment allows for the definition of segments that are fixed
and for which references are always safe. This goes in tandem with the
asan:safe comment, which can then be used more sporadically.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Add a warning for unknown cross-mapping references</title>
<updated>2026-07-08T19:27:49Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-07-08T19:13:00Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=0664f0bad653ca750d320e513f685ab0c852f359'/>
<id>urn:sha1:0664f0bad653ca750d320e513f685ab0c852f359</id>
<content type='text'>
Some segments, like the 'vectors' one, will reference code that is
outside of its mapping. But in some other configurations, segments
cannot make these cross-mapping references so happily. Imagine:

    .segment "SWAPPABLE"

    .proc foo
        rts
    .endproc

    .segment "FIXED"

    jsr foo

Here the assembler will properly detect the address of 'foo' in the
context of the 'SWAPPABLE' segment. But what this assembler doesn't know
is that this segment is swappable (e.g. UNROM chip). Hence, if the bank
being mapped right now is not the one containing the 'SWAPPABLE'
segment, then the address computed for 'foo' and used in that 'jsr'
instruction will point to something else entirely. This would be similar
to a use-after-free bug.

This is something that can only be inspected at runtime, and so the
assembler cannot be of much help here. Hence, this commit adds a warning
so the programmer can understand the potentially dangerous operation.

All of that being said, this commit also adds support for "asan:safe" or
"check:safe", which is a magic comment that the programmer can write to
re-assure the assembler that this operation is fine (e.g. there is a
guarantee that the mapped bank is that one we are expecting). Hence, the
code above could now be written like so:

    jsr foo      ; check:safe

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Upgrade to the 2024 edition of Rust</title>
<updated>2026-07-08T19:09:42Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-07-08T18:45:05Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=6333dc7ee02332cd06e20b56cefd3210368e54f8'/>
<id>urn:sha1:6333dc7ee02332cd06e20b56cefd3210368e54f8</id>
<content type='text'>
And also adjust the code so the clippy from the 2024 edition is fine
with it.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Allow a magic "check:ignore" comment</title>
<updated>2026-04-30T10:44:50Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-04-30T10:44:08Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=4fa306e9011978cc374f6ab402ccb3602176d4ba'/>
<id>urn:sha1:4fa306e9011978cc374f6ab402ccb3602176d4ba</id>
<content type='text'>
This is basically the same as "asan:ignore", but to the programmer it
will sound less weird on non-ASAN uses.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Ensure expressions in arguments are fully parsed</title>
<updated>2026-04-23T20:17:23Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-04-23T20:17:23Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=7c01c29cec6f5fcc94abcd154c47d2c78f765a78'/>
<id>urn:sha1:7c01c29cec6f5fcc94abcd154c47d2c78f765a78</id>
<content type='text'>
Imagine the following scenario:

        lda #.lobyte(@address + 1)

Here we have an immediate which comes from the .lobyte call. That being
said, since this is using the '#' symbol, we look ahead after noticing
it just in case we need to disambiguate some scenarios. When a
parenthesis is found, in extract_paren_expression() we temporarily
discard the looking ahead status as expressions inside of parenthesis
are no longer affected by any hypothetical external ambiguity. This,
though, was not being done in parse_arguments(), which is the function
that would be called in the above scenario.

Hence, ensure that we temporarily decrease the look ahead status for the
inner arguments, and then increase it back when we are done. This way,
when the parser finds '@address', it will no longer go the "we have
found a 'value', refrain from ambiguities and return early" route, and
it will check for any binary expression.

Note that all this dance actually applied here, as binary operations are
a source of ambiguities, and the look ahead mechanism was brought about
because of these kinds of expressions. Hence, it's not like the look
ahead mechanism is troublesome in on itself, we just missed the special
handling on this specific scenario.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Implement the asan:stack statement</title>
<updated>2026-04-08T14:04:12Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-04-08T14:04:12Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=a2cb050ca18fd7c5533d69e9aa093e4f0a40d0fa'/>
<id>urn:sha1:a2cb050ca18fd7c5533d69e9aa093e4f0a40d0fa</id>
<content type='text'>
This statement allows programmers to reserve a memory range for the
stack. This is useful to reserve a memory region which is not attached
to any variable, and:

1. It is a way to safely reserve space on the $0100 page.
2. The --stats/--write-info flags will be able to add up the memory
   space reserved for the stack.
3. Future tooling might be able to use this value as a way to detect
   stack overflows.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Raise an error when a control statement does not exist</title>
<updated>2026-02-25T21:10:36Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-02-25T21:10:36Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=3f1614b8511f8c952fb174dfbb5b346f1c7b792f'/>
<id>urn:sha1:3f1614b8511f8c952fb174dfbb5b346f1c7b792f</id>
<content type='text'>
In this case it was silently letting it go in the hopes that the
assembler would catch it, but it's better to just handle it in the
parser and give a proper error instead of complicating the assembler a
bit more.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>Change .fallthrough to __fallthrough__</title>
<updated>2026-02-02T22:22:47Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-02-02T22:13:57Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=31dd071e927ab4375db6c408c08ab776e4a5c655'/>
<id>urn:sha1:31dd071e927ab4375db6c408c08ab776e4a5c655</id>
<content type='text'>
Implementing it as a control statement has the bad thing that it's
impossible to be compatible with other assemblers such as ca65, as you
cannot create dummy control statements or something like that in
there. Instead of that, we define it with the special underscores which
are still valid for identifiers, and give a "compiler-specific thingie"
flair to it.

This also has the benefit that the parser can be a bit more strict.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
<entry>
<title>xixanta: add context from macro expansions</title>
<updated>2026-02-02T18:56:21Z</updated>
<author>
<name>Miquel Sabaté Solà</name>
<email>mssola@mssola.com</email>
</author>
<published>2026-02-02T18:56:21Z</published>
<link rel='alternate' type='text/html' href='https://git.mssola.com/nes/tools.nes/commit/?id=930ad1cc4422f19251ea77a625816e3aebcc6eea'/>
<id>urn:sha1:930ad1cc4422f19251ea77a625816e3aebcc6eea</id>
<content type='text'>
The way macro expansions work is that the evaluated bundles replace the
current node, but this throws away the context of the line, the source,
etc. from the original line of code.

Add a stack that is pushed/popped when expanding macros, and are then
cloned for each pending node and error. This way, errors have full
context of the original code and can display backtraces for macro
expansion.

Signed-off-by: Miquel Sabaté Solà &lt;mssola@mssola.com&gt;
</content>
</entry>
</feed>
