RacketLite

Make the code explain itself.

A small Racket interpreter, written in C#.

Read the C# source

Independent project · Creator & Software Architect

Change the code. See it run.

Example result

18

Enable JavaScript to edit and run this example.

Expression tree

+6*34
  1. (* 3 4) → 12
  2. (+ 6 12) → 18

Example trace · Run to inspect your expression.

Browser demo of a small subset. The original interpreter is C# / .NET. Nothing you enter is sent to a server.

Supported syntax

Numbers, quoted strings, booleans (#true / #false), and nested expressions.

+ − * / abs sqrt min max = > < >= <= if and or not string-append string-length string-upcase string-downcase

Use the keyboard’s hyphen for subtraction. One expression at a time; no variables, definitions, user functions, loops, files, network access, or host-language evaluation. Limits: 2,000 characters, 256 tokens, 32 nesting levels, and 256 evaluation steps. Numbers use JavaScript precision. Ctrl/⌘ + Enter runs the expression.

What I built.

The parser, expression model, and evaluator.