Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Introduction

Yagbas is a programming language that builds programs for the Game Boy and other compatible devices. A lot of useful documentation for this device family can be found in the Pan Docs.

Because of the limited nature of the Game Boy's CPU instruction set, Yagbas does not aim to be a "general purpose" programming language. Instead, it is intended to be much closer to "assembly with modern syntax".

Yagbas looks mostly like Rust, where possible.

Language Reference

Modules

A yagbas source file is called a "module".

Tokens

Source code has to be tokenized first during compilation. This breaks it up into punctuation, keywords, identifiers, and so on.

  • Identifiers: These start with an ASCII letter or an underscore, and can then contain any number of ASCII letters, underscores, and digits. Identifiers can't be any language keyword.
  • Numbers: Numbers can be in decimal, binary (with a leading %), or hexadecimal (with a leading $). Numbers can contain underscore characters for easier reading, this doesn't affect the value.
  • Line Comments: Line comments start with // and go to the end of the line.

Token Trees

Tokens are grouped into "trees" with pairs of opening and closing markers.

  • Parens: ( and )
  • Braces: { and }
  • Brackets: [ and ]
  • Block Comments: /* and */

The opening and closing markers for each token tree group must match, or the source file cannot be processed.