A REPL for an experimental Programming Language which currently uses a 'lispy' syntax.
- PL is the umbrella repo that should describe the concepts of the language.
- PLLispy should provide an overview of the syntax this REPL accepts
This REPL is primarily useful for development as most of the project is at an unfinished and experimental phase.
The primary interface is a Terminal User Interface powered by Brick which supports parsing, reducing, type checking and printing expressions.
A less stable web interface is also defined using GHCJS and Miso.
This project is developed with Haskells stack.
Direct cabal
support is untested.
A number of PL dependencies are pinned by the stack.yaml
. Build with stack build
.
If you wish to install globally, run stack install
to install the pl
executable to your global stack binaries directory.
If installed globally, call pl
. If built locally, call stack exec pl
.
Call pl repl
to launch a brick-based command line interface split into several panes.
- The top-left
widget
is an PLEditor-based editor for inputing lispy source code. - The bottom-left widget is an output text area that displays the result of parsing/ type checking code entered into the editor widget.
- The right widget displays a context of the types currently defined and available to be mentioned in the editor.
Commands are entered by pressing keys, either a single key (such as an up
arrow), or multiple (such as the up arrow while holding the control key).
Most commands will be sent to whatever widget
we consider in focus
. Some
commands are global
and affect the entire repl.
Below is an overview of some of the commands the repl understands.
Key combination | Targets | Action |
---|---|---|
up |
focused | Move the cursor up in the focused widget |
ctrl + up |
focused | Make the current view within a widget taller |
down |
focused | Move the cursor down in the focused widget |
ctrl + down |
focused | Make the current view within a widget shorter |
left |
focused | Move the cursor left in the focused widget |
ctrl + left |
focused | Make the current view within a widget narrower |
right |
focused | Move the cursor right in the focused widget |
ctrl + right |
focused | Make the current view within a widget wider |
any other character |
editor | Insert character into the editor widget |
HOME |
editor | Insert a random code sample into the editor |
DELETE/ BACKSPACE |
editor | Delete the current character in the editor widget |
ENTER |
editor | Insert a newline in the editor widget |
INSERT |
editor, output | Grab the text in the editor and run it through the configured repl. This usually means parsing, type-checking and evaluating. Output appears in the output widget. If successful, the editor widget is cleared |
PAGE-UP |
global | Switch focus to the next widget |
PAGE-DOWN |
global | Switch focus to the previous widget |
ctrl + l |
editor | Clear all text from the editor widget |
ESC |
global | Exit the program |
Below are a couple of example functions entered into the repl.
Subtracting two from a natural number:
The web UI is built with GHCJS and uses Nix for dependency management.
You may want to use misos binary cache to speed up builds:
nix-env -iA cachix -f https://cachix.org/api/v1/install
cachix use miso-haskell
Build with nix:
nix-build JS/
If dependencies have not been cached this is likely to take a long time.
Build artifacts are linked under result/bin/client.jsexe/
.
You should be able to open example.html
in a browser.
A hosted version should be available here.