GithubHelp home page GithubHelp logo

scryer-shen's Introduction

Scryer Shen

An experimental, in-progress implementation of the Shen programming language in Racket and Scryer Prolog.

Unlike most other implementations of Shen, scryer-shen implements Shen directly in its host languages without bootstrapping from a seed implementation of KLambda.

The intention is to allow direct integration of Scryer Prolog inside a Shen implementation. Scryer Prolog is a performant ISO Prolog system with powerful metaprogramming capabilities and highly general and expressive constraint logic programming libraries over integers and booleans among many other features.

The integration should naturally extend Shen's logic and type systems to allow styles of dependently typed programming and theorem proving akin to those found in programming languages like Agda and Lean.

Progress to a fully featured Shen implementation

  • Add define, defun
  • Add defmacro and package
  • Add defprolog and prolog?
  • Add if and cond forms
  • Add @v, @p and @s constructors/patterns
  • Add freeze and thaw
  • Add deftype and support for type signatures in functions
  • Use raco and Racket's compiler API to automatically download, compile and package Scryer Prolog with Scryer Shen
  • Implement the rest of the Shen standard library
  • Implement Shen-YACC

Installation

scryer-shen can be run in the Racket REPL (for #lang shen modules) or compiled to an executable using

# Install [GNU Make](https://www.gnu.org/software/make/#download)
# Install [racket](https://download.racket-lang.org/)
# before 
# - logging into a shell terminal, and
# - executing the following commands
# from cloned `scryer-shen` project root directory
# before passing `ensure-scryer-shen-executable-availability` target to make binary
# so that making `shen` executable is made available
make ensure-scryer-shen-executable-availability

The scryer-prolog executable must be copied to the install directory dist/bin. It can be downloaded from the above link and built by following the instructions there. Soon this requirement will be automated through raco.

Non-standard extensions of Shen Prolog

Scryer Shen has full access to Scryer Prolog's library modules. They are loaded in prolog? forms using the non-standard syntax

(1-) (prolog? (use-module (library clpz)))

Also unlike standard Shen Prolog, Scryer Shen Prolog supports functor notation for the sake of partial evaluation in libraries like clpz:

(2-) (defprolog fac
0 1 <--;
N R <-- (#> N 0)
        (#= N1 -(N 1))
        (#= R *(N F1))
        (fac N1 F1);)
(3-) (prolog? (fac X 120) (return X))
5

-(N 1) and *(N F1) annotate the ISO Prolog functors -(N,1) and *(N,F1) while s-expressions annotate either Shen function calls or Prolog predicate calls as in standard Shen Prolog.

Scryer Shen Prolog predicates and queries are converted to ISO Prolog and streamed to the Scryer Prolog subprocess. The interaction between Scryer Shen and Scryer Prolog is displayed in the Scryer Prolog Debug Window, which for the above interaction is

Scryer Prolog Debug Window

Scryer Prolog's delimited continuations library cont is used to interact with Scryer Shen using the reset and shift primitives.

scryer-shen's People

Contributors

mthom avatar thierrymarianne avatar jagen31 avatar

Stargazers

 avatar joao guilherme avatar  avatar  avatar  avatar Hrishikesh Choudhari avatar Ayush Kumar avatar  avatar  avatar Philip Zucker avatar  avatar KevinLi avatar Cristián Romo avatar Boticello avatar Carwyn Edwards avatar Austin Pahl avatar  avatar Thomas Hühn avatar João Fernando Apel Miguel avatar Matthias Hetzenberger avatar Joe Taber avatar Ott Värimäe avatar Fernando Raya avatar Peter avatar  avatar Andrejs Agejevs avatar J. Ryan Stinnett avatar Adrián Arroyo Calle avatar

Watchers

Abhik Khanra avatar  avatar Adrián Arroyo Calle avatar  avatar

scryer-shen's Issues

Relaxing installation requirement maybe. 🧘

Hey!

After successful raco setup execution,
when running from the root directory the next command,

raco exe --cs -o shen ++lib racket/lang/reader repl.rkt

I got the attached error related to collection

raco exe --cs -o shen ++lib racket/lang/reader repl.rkt
repl.rkt:8:9: collection not found
  for module path: shen/lang/interposition-points
  collection: "shen/lang"
  in collection directories:
   /Users/shal/Library/Racket/8.12/collects
   /Applications/Racket v8.12/collects/
   ... [170 additional linked and package directories]
  location...:
   repl.rkt:8:9
  context...:
   /Applications/Racket v8.12/collects/compiler/embed.rkt:445:0: get-code
   /Applications/Racket v8.12/collects/racket/private/map.rkt:267:2: gen-for-each
   /Applications/Racket v8.12/collects/compiler/embed.rkt:1183:0: do-write-module-bundle
   /Applications/Racket v8.12/collects/compiler/embed.rkt:1663:15: write-module
   /Applications/Racket v8.12/collects/compiler/embed.rkt:1567:6
   /Applications/Racket v8.12/share/pkgs/compiler-lib/compiler/commands/exe.rkt:100:0
   body of "/Applications/Racket v8.12/share/pkgs/compiler-lib/compiler/commands/exe.rkt"
   /Applications/Racket v8.12/collects/raco/raco.rkt:41:0
   body of "/Applications/Racket v8.12/collects/raco/raco.rkt"
   body of "/Applications/Racket v8.12/collects/raco/main.rkt

Before realizing i had not copied scryer-prolog executable to dist/bin.

Would you like me to submit a pull-request
embedding a Makefile or something else
so that we could

  • check racket binary availability
  • check Scryer prolog binary availability
  • run raco setup
  • run raco exe --cs -o shen ++lib racket/lang/reader repl.rkt

by running a single target perhaps?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.