Skip to content
/ PLRepl Public

A REPL for an experimental programming language with lispy syntax

Notifications You must be signed in to change notification settings

syallop/PLRepl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PLRepl - experimental

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.

Terminal REPL

Building

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.

Installing

If you wish to install globally, run stack install to install the pl executable to your global stack binaries directory.

Executing

If installed globally, call pl. If built locally, call stack exec pl.

Using

Call pl repl to launch a brick-based command line interface split into several panes.

Overview

  • 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

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

Examples

Below are a couple of example functions entered into the repl.

Boolean and: Boolean And

Subtracting two from a natural number: Subtract Two

Web REPL

Building

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.

Using

Build artifacts are linked under result/bin/client.jsexe/.

You should be able to open example.html in a browser. Web UI

A hosted version should be available here.

About

A REPL for an experimental programming language with lispy syntax

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages