Skip to content

Add Character Support to the assembler.#10

Open
gilkeidar wants to merge 2 commits intomainfrom
assembler-character-support
Open

Add Character Support to the assembler.#10
gilkeidar wants to merge 2 commits intomainfrom
assembler-character-support

Conversation

@gilkeidar
Copy link
Owner

@gilkeidar gilkeidar commented Jan 20, 2026

Added a new TokenType: TokenType::CHARACTER.

Can specify a Character token using the new OUT Assembly Instruction; hence, the following code:

// First, painstakingly define preprocessor constants for each character value.
// Note: these could be hardcoded into the assembler, but this would introduce a lot of reserved constants values
// that aren't necessarily obvious to be built-in constants; additionally, they're less readable than built-in characters.
.define 1 NEW_LINE 0x10
.define 1 SPACE 0x20
.define 1 _A 0x41

// Print " A\n"
OUT SPACE, A
OUT _A, A
OUT NEW_LINE, A

Can be replaced with the following new code:

// Print " A\n"
OUT ' '
OUT 'A'
OUT '\n'

As you can see, special characters (that are escaped using \) have also been added, and largely follow C's set of escaped characters.

Closes #3

@gilkeidar gilkeidar self-assigned this Jan 20, 2026
@gilkeidar gilkeidar added the enhancement New feature or request label Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add character values to Assembler v2

1 participant