Giff Language Specification - Owen2k6/GoOS GitHub Wiki

Language Specification

Lexical elements

  • Identifiers: A–Z a–z 0–9 _ . (dot allowed). Case-insensitive when used as property keys.
  • Numbers: decimal integers, may be negative (e.g., -12, 640).
  • Strings: single or double quotes. Supports escapes: \n \r \t \\ \" \'.
  • Punctuation: { } = : ; , ( ) + - * / % $.
  • Comments: // to end of line.
  • Hash words: #word (reserved for potential future directives; currently parsed as values where accepted).

Statements and blocks

Top level accepts multiple window blocks:

window MyWin { ... }
window Another { ... }

Inside a window or panel block you may place controls, events, and properties:

  • Controls: label, input, button, image, listbox, panel.
  • Events: onLoad { ... }, onClose { ... } (window only), onClick, onChange, onSelect.
  • Properties: key = value or key : value or key value. End with optional ;.

Property value kinds

A value may be:

  • String: "text" or 'text'
  • Number: 320
  • Identifier: true, false, white, center (treated as text tokens)
  • Hash word: #something

The parser writes properties into a dictionary of strings, then specific parsers convert to int, bool, or colour.

Booleans

Accepted truthy/falsey strings for boolean properties:

  • true, 1 → true
  • false, 0 → false (Comparison is case-insensitive.)

Colours

background / backgroundColour / textColour accept:

  • Named: white, black, lightgray|lightgrey, gray|grey, transparent.
  • Hex: #RRGGBB or RRGGBB.

Centre flags

For labels you may centre horizontally via any of: centre, centrex, center, centerx (case-insensitive) → true|false.

⚠️ **GitHub.com Fallback** ⚠️