> play_

Try Neper in your browser

The compiler on this page is Neper's own, compiled to WebAssembly (neper.wasm, 4.4 MB). It reads your source, writes a wasm32-wasi module, and the page runs it. Nothing is uploaded and nothing is installed.

Loading the compiler…

      

This page hosts a small part of the standard library, enough for the samples: e.io, e.mem, e.str, e.math, e.bytes, e.algo.sort, e.text.regex, e.fmt.json and e.crypto.hash, with what they use. A use of any other module reports that it is missing. The full compiler and library are on GitHub, and Get started shows how to cross compile for any OS with no third-party toolchain.

What happens when you press Compile and run

Your source goes to neper.wasm, Neper's own compiler built for WebAssembly. It checks the program, writes a wasm32-wasi module with its own emitter, and the page runs that module in a separate Worker. The compiler, the library files and your program all run in your browser, and nothing is uploaded.

What the samples show

  • hello.e is the smallest program: the root arena, the arguments and one io.print.
  • strings.e builds, joins and formats strings in an arena, with the format string checked at compile time.
  • squares.e is a loop, an accumulator and a formatted line.
  • sort.e sorts in place with e.algo.sort, then again with a comparison function you pass.
  • regex.e finds every match of a pattern and replaces them with e.text.regex, a Pike VM with no backtracking blow-up.
  • json.e parses a document with e.fmt.json and walks the result.
  • sha256.e hashes a string with e.crypto.hash and prints it as hex with e.bytes.
  • math.e calls floor, sin and pow from e.math, which is Neper code and not libm.

Questions

Is my code sent anywhere?

No. The page fetches the compiler and the library files it needs from neper.dev, and everything after that happens locally.

Why is the first compile slower?

The compiler asks for each library module the program uses, and the page fetches those files once. The browser caches them, so later compiles take a few hundred milliseconds.

What does it compile to?

wasm32-wasi, which the page runs. The same compiler builds native Windows, Linux and macOS executables from one machine with no third-party toolchain; Get started shows the commands.

What are the limits?

A program is stopped after 10 seconds, a compile after 30 seconds, and output is cut at 100 KB. The Stop button ends either at once. Only the library modules listed above are hosted here.