Pry open those interpreters.
Go to file
Toby Ho 22c750d920
Added overlay (#108)
* added overlay

* Update flake.nix

Co-authored-by: Ryan Mulligan <ryan@ryantm.com>

---------

Co-authored-by: Ryan Mulligan <ryan@ryantm.com>
2023-05-05 10:30:29 -04:00
.circleci vendored @replit/node-fetch so it builds in pid1 wo network access (#95) 2022-08-22 10:00:49 -04:00
languages Updated nixpkgs to 22.11 channel (#102) 2022-12-09 17:17:50 -05:00
prybar_assets vendored @replit/node-fetch so it builds in pid1 wo network access (#95) 2022-08-22 10:00:49 -04:00
scripts Updated nixpkgs to 22.11 channel (#102) 2022-12-09 17:17:50 -05:00
test_files vendored @replit/node-fetch so it builds in pid1 wo network access (#95) 2022-08-22 10:00:49 -04:00
tests Updated nixpkgs to 22.11 channel (#102) 2022-12-09 17:17:50 -05:00
utils Ensure exit codes (where applicable) (#82) 2022-01-18 12:03:34 -06:00
.dockerignore - Add exec-style languages 2018-11-06 18:48:24 -08:00
.gitignore vendored @replit/node-fetch so it builds in pid1 wo network access (#95) 2022-08-22 10:00:49 -04:00
.prettierrc Add global prettier config. (#97) 2022-09-16 13:46:55 -07:00
build-prybar.nix Updated nixpkgs to 22.11 channel (#102) 2022-12-09 17:17:50 -05:00
COPYING Fix up whitespace 2019-06-03 14:11:22 -07:00
default.nix Get tests passing and skip some prybars on darwin 2021-07-06 11:08:49 -06:00
Dockerfile Fix the docker tests so they work with the new changes (hopefully) 2021-06-25 14:13:09 -04:00
Dockerfile.dev Fix the docker tests so they work with the new changes (hopefully) 2021-06-25 14:13:09 -04:00
flake.lock Updated nixpkgs to 22.11 channel (#102) 2022-12-09 17:17:50 -05:00
flake.nix Added overlay (#108) 2023-05-05 10:30:29 -04:00
go.mod Recreate nodejs REPL logic (#78) 2021-11-18 18:33:40 -06:00
go.sum Recreate nodejs REPL logic (#78) 2021-11-18 18:33:40 -06:00
inject_claunch.go - Add exec-style languages 2018-11-06 18:48:24 -08:00
inject_elaunch.go - Add exec-style languages 2018-11-06 18:48:24 -08:00
logo.svg Fix up whitespace 2019-06-03 14:11:22 -07:00
Makefile Switch to CircleCI and fix Tcl tests (#35) 2019-07-24 13:29:06 -07:00
osx-env.sh Split c code out into files 2018-10-19 14:40:24 -07:00
README.md Updated nixpkgs to 22.11 channel (#102) 2022-12-09 17:17:50 -05:00
run_no_pty Copy prybar assets into Nix derivation 2021-10-12 13:02:09 -05:00
run_tests Updated nixpkgs to 22.11 channel (#102) 2022-12-09 17:17:50 -05:00
run_tests_language Updated nixpkgs to 22.11 channel (#102) 2022-12-09 17:17:50 -05:00

Prybar

Prybar is a universal interpreter front-end. Same interface, same REPL, different languages.

Why

At Repl.it, we're in the business of running REPLs. As it happens to be, every language implements them differently. We wanted them to all behave the same: run code and drop into a REPL!

How it works

Prybar, written in Go, maintains a common command-line interface that calls into a select language backend. When possible, the language backends are implemented using cgo and the language's C-bindings. Otherwise, they make use of a small script written in the host language which starts a Prybar-compatible REPL.

Usage

Usage: ./prybar-LANG [FLAGS] [FILENAME]...
  -I	interactive (use readline repl)
  -c string
    	execute without printing result
  -e string
    	evaluate and print result
  -i	interactive (use language repl)
  -ps1 string
    	repl prompt (default "--> ")
  -ps2 string
    	repl continuation prompt (default "... ")
  -q	don't print language version

Language Support

language eval eval expression eval file repl repl like eval set prompt
Clojure -
Emacs Lisp
Javascript (nodejs)
Javascript (spidermonkey) -
Julia
Lua 5.1
OCaml
Python 2.7
Python 3.x
R
Ruby 2.5
SQLite
Tcl -

Start to Develop with Nix

To get started developing Prybar, you can use the nix shell. Enter

nix develop

to drop into a shell that has all dependencies installed an ready to go.

If you don't have nix yet, install that: https://nixos.org/

Build and run

% make help
usage:
  make all          Build all Prybar binaries
  make prybar-LANG  Build the Prybar binary for LANG
  make docker       Run a shell with Prybar inside Docker 
                    (don't do this in the nix shell, although this is
                                            not needed if you use nix)
  make image        Build a Docker image with Prybar for distribution
  make test         Run integration tests
  make test-image   Test Docker image for distribution
  make clean        Remove build artifacts
  make help         Show this message

You can also use Docker

Prybar uses Docker to make it easy to get started with development. First, you must install Docker. Then, run:

$ make docker

to create a Docker image containing the Prybar code and all of its dependencies, and launch a shell inside of it. The Prybar source repository will be synchronized with the working directory of the container's filesystem, so you only need to re-run make docker if you change the Dockerfile or any of its scripts.

To build Prybar (this should be done inside make docker unless you have installed all of Prybar's dependencies on your system), run make or make all. Then the prybar-LANG binaries will be available in the working directory and on $PATH, one for each supported language LANG (see the languages subdirectory of this repository):

$ prybar-python3 -h

Distribution

Run make image to create a Docker image containing not only Prybar's dependencies and source code but also its compiled binaries, which can be embedded inside other Docker images by means of COPY --from=basicer/prybar.

This image is automatically built and deployed to Docker Hub every time a commit is merged to master.

License

Copyright (C) 2004-2018 Neoreason, Inc. et al.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.

See the COPYING file for more information regarding the GNU General Public License.