gasm is the intermediate language and assembly language
of the garter compiler toolchain.
The gasm assembly syntax is intended to be platform-agnostic wherever possible.
the Garter Assembler takes in *.gasm files and generates
*.gyb object files.
Lexical analysis breaks apart the source files
into tokens: keywords, labels/addresses, constants,
et cetera. Then the parser iterates over the list of tokens
and essentially "interprets" them --
instructions will either change the assembler's internal state,
or be translated and treated as emitter commands.
When the assembler first starts, it initializes an empty object with a clean-slate symbol table. Any time we encounter symbol definitions, we push those to our symbol table.
Later, somewhere in our *.gasm file,
we might see a block of code that looks like
section executable
move rax, raxsection executable is a directive that
changes what section the emitter is currently
sending data into,
then the instruction move rax, rax
will be converted into data and put
into the selected section.
gasm is heavily influenced by x86 Intel Assembly,
FlatAssembler, BASIC, and Python, and looks something like:
section writeable
hello
u8 "Hello, World" 0
section executable
immediate ar hello
immediate br 12
syscall write stdout ar br
immediate 0
syscall exit arFor tutorials, see the garter website.
For a guide on writing Garter Assembly,
see the garter specification doc.