Reference Manual
manual://introduction

Introduction

bunnyBASIC is a browser-based, BASIC-inspired language and runtime.

The current browser build is geared toward small line-oriented programs, fast experimentation, explicit runtime types, block-based control flow, timers, and pixel or shape-based graphics.

Running code

Stored bunnyBASIC programs are line-numbered internally. The numbered form shown in these docs is the same form produced by commands like LIST and PRETTY.

In the browser editor, bunnyBASIC manages those numbered lines for you. In the terminal-style workflow, you will see and edit the numbered form directly.

Press the ~ key to open the full code editor in a quake-console-style overlay. On many keyboards this is the same physical key as backtick, and closing the editor syncs its contents back into the runtime.

First program

10 PRINT "Hello, bunnyBASIC"

PRINT takes a comma-separated list of expressions. The runtime prints them with spaces between values.

First block program

10 $COUNT = 3
20 IF $COUNT > 0
30   PRINT "ready"
40 ELSE
50   PRINT "idle"
60 END IF

First graphics program

10 CLS
20 LINE (20, 20)-(180, 100), 10
30 CIRCLE (256, 256), 60, 12
40 PIXEL (256, 256), 15

The immediate drawing statements use integer coordinates and palette indexes on a 512 x 512 canvas.

Shape-based drawing

Besides direct pixel commands, bunnyBASIC can build and transform shapes as expressions:

10 $RING = <256.0, 256.0> + (180.0 * CIRCLE()) - (<256.0, 256.0> + (100.0 * CIRCLE()))
20 DRAW $RING

RECT() and CIRCLE() create unit shapes. You then scale, rotate, combine, and translate them before drawing with DRAW.

Where to go next

  • Read Syntax for the actual type system and operator rules
  • Read Commands for the supported statements and built-in functions
  • Read Examples for verified programs that match the implemented language