First Program

Run a Lispex program in the Playground or from a .lspx file, understand its output, fix one reader error, and add the official editor extension.

The fastest way to understand Lispex is to modify a program and watch its value update. Start in the browser. Install a local runtime only when you want to keep a file.

Run it in the Playground

Open the Playground, replace the editor contents with this program, and choose Run.

LISPEX
(define language "Lispex")

(list 'hello language (+ 2 3))

Result

OUTPUT
(hello "Lispex" 5)

The first form gives the string "Lispex" the name language. The final form builds a list from a quoted symbol, that string, and the result of (+ 2 3). The Playground prints the value of every top-level expression that produces one or more values. define itself produces no printed value.

Change 3 to 8 and run again. If the final element becomes 10, you have completed the browser part of the lesson.

Keep it as a local file

Save the same source as hello.lspx. Choose either local product.

SHELL
npx lispex hello.lspx

Or download the Native binary for your platform and run it.

SHELL
lispex hello.lspx

Both commands run the same reference implementation written in Rust. The npm package delivers it through WebAssembly. The Native binary runs it directly. See Downloads for platform-specific installation and checksum steps.

That is all a first program needs. Native users who later want a compiled file that comes out the same way every time from the same source can continue to Run Verified Bytecode. The beginner course remains source-first.

Add editor color, the file icon, and formatting

The official extension recognizes .lspx files, highlights Lispex syntax, supplies the Lispex file icon for light and dark themes, and formats a document through the installed Native CLI.

The exact identifier is studiohaze.lispex. Once you install the Native binary, format files with Format Document or format-on-save. The extension runs lispex fmt -. Set lispex.format.executable if the binary is not on PATH. The extension does not bundle a runtime, language server, autocomplete, hover types, or editor diagnostics. Formatting is unavailable through npm, the public WebAssembly build, or the Playground.

Read one diagnostic

Now remove the closing parenthesis from the first define.

LISPEX
(define total 10

(+ total 5)

The command exits unsuccessfully and reports an E100 reader diagnostic. The important part is the stage. Lispex could not finish reading one source form, so no expression ran. Restore the ) after 10 before looking for a runtime problem.

Lispex writes diagnostics to standard error, and a failed run returns a non-zero exit status. Later, Diagnostics separates reader, normalization, runtime, and resource failures.

Exercise

Change the successful program so it prints this.

(hello "Lispex" 12)
Show one answer

Change the final expression to (list 'hello language (* 3 4)). Lispex evaluates the nested call (* 3 4) before list receives its three values.

Ready for Step 2?

Continue when you can point to the name, the string, the nested call, and the final list in the first program. Next comes Values, Names, and Procedures.