• Stars
    star
    1,060
  • Rank 42,473 (Top 0.9 %)
  • Language
    JavaScript
  • License
    Other
  • Created over 11 years ago
  • Updated 19 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The Pyret language.

Yarr

Build Status

A scripting language.

To learn about the language, visit pyret.org.

To read an introduction of the language, visit the tour.

To read the documentation, visit pyret.org/docs/.

There are three main ways to use Pyret:

  1. If all you want to do is program in Pyret, there is a web-based environment at code.pyret.org that lets you run and save programs that should be all you need. If you're a student using Pyret, this is probably where you will do your assignments, for example.

  2. If all you want to do is program in Pyret at the command line, you should install pyret-npm from https://www.npmjs.com/package/pyret-npm, using an install command like:

    npm install -g pyret-npm
    

    (If you're new to node and npm, you might find https://nodejs.dev/learn/an-introduction-to-the-npm-package-manager and https://nodejs.dev/learn/npm-global-or-local-packages useful background).

  3. If you want to contribute to Pyret, or try out experimental features, the README starting below is for you.

The use of vocabulary from http://bvipirate.com/piratespeak/index.html is recommended when commenting and reporting issues.

Installing

First, make sure you've installed Node >= 6. Then run:

$ npm install
$ make
$ make test

It'll build the Pyret compiler and run the tests.

Running Pyret

If you just want to run Pyret, visit the online environment and work from there. If you're interested in Pyret development, read on:

The easiest way to run a Pyret program from the command-line is:

$ ./src/scripts/phaseX <path-to-pyret-program-here> [command-line-args...]

Where X is 0, A, B, or C, indicating a phase (described below). For example:

$ ./src/scripts/phaseA src/scripts/show-compilation.arr examples/ahoy-world.arr

Alternatively, you can compile and run a standalone JavaScript file via:

$ node build/phaseX/pyret.jarr \
    --build-runnable <path-to-pyret-program-here> \
    --outfile <path-for-standalone-js> \
    --builtin-js-dir src/js/trove/ \
    --builtin-arr-dir src/arr/trove \
    --require-config src/scripts/standalone-configA.json
$ node <path-for-standalone-js>

Phases

Pyret is a self-hosted compiler, which means that building requires some thought. If you're going to get into the guts of the compiler, a brief overview is worth reading. The build directory is separated into four distinct phases.

  1. Phase 0 is a standalone JavaScript file that contains an entire compiled Pyret compiler and runtime. This large blob gets committed into version control whenever we add a nontrivial feature to the language. It is large and somewhat slow to load, but whatever is in build/phase0/pyret.jarr is currently the canonical new-world implementation of Pyret.

  2. Phase A is set up to be populated with built versions of all the files for the compiler, built by the phase 0 compiler. Phase A is what most of the testing scripts run against, since it is the easiest to create, and after it is built it is your development snapshot of the compiler you're working on. However, just building phase1 is not enough to fully re-boostrap the compiler, because it contains a mix of old-compiler output and any new changes that were made to runtime files.

  3. Phase B is set up to be populated with built versions of all the files for the compiler, built by the phase A compiler. This version does represent a fully-bootstrapped compiler. If you run make phaseB, you get a new standalone compiler in the same format as build/phase0/pyret.js.

  4. Phase C builds from phase B. One major use of phase C is to check the bootstrapped compiler from phase B. Before committing a new standalone in phase 0, build both phaseB and phaseC, and check:

    $ diff build/phaseB/pyret.jarr build/phaseC/pyret.jarr
    

    And it should be empty, which indicates that the bootstrapped compiler is at least correct enough to recompile itself without error.

    To rebuild the compiler and get a new phase0, run

    $ make new-bootstrap
    

    which will build the phaseB and phaseC standalones, check the diff, and copy to phase0 if the diff is empty.

More Repositories

1

flapjax

functional reactive programming for JavaScript
JavaScript
232
star
2

LambdaJS

Semantics and tools for JavaScript
JavaScript
91
star
3

LambdaS5

Semantics for ES5
OCaml
79
star
4

B2T2

The Brown Benchmark for Table Types (B2T2)
TypeScript
59
star
5

lambda-py

Racket
58
star
6

code.pyret.org

Website for serving Pyret to folks.
JavaScript
24
star
7

ML-LambdaJS

JavaScript semantics
JavaScript
18
star
8

cs173-python

Python framework code for cs173/fall 2012
Racket
17
star
9

strobe

The Strobe Type Checker for JavaScript
JavaScript
15
star
10

Resugarer

Lifting Reduction Semantics through Syntactic Sugar
Racket
13
star
11

TeJaS

A family of type systems for JavaScript
OCaml
12
star
12

webbits

An updated webbits is available at https://github.com/jswebtools/language-ecmascript
JavaScript
10
star
13

pyret-docs

The documentation for Pyret.
Racket
9
star
14

scope-graph

Aims for defmacro style macros, with the type system guaranteeing hygiene and binding-safety.
Rust
8
star
15

javascript-contracts

design-by-contract library for JavaScript
Haskell
7
star
16

examplar

A Pyret editor for supporting example-first design.
JavaScript
7
star
17

admiral-edu

Captain Teach 2.0
JavaScript
6
star
18

insta-model

TeX
6
star
19

judgmental-resugaring

Racket
5
star
20

ZZZ-captain-teach

Set sail for Learning Island! Deprecated and no longer maintained
JavaScript
5
star
21

hygienic-resugaring

Prototype implementation for "Hygienic Resugaring of Compositional Desugaring", ICFP'15.
Makefile
5
star
22

BlockLang

Visual block syntax for Whalesong
JavaScript
4
star
23

vscode-language-pyret

4
star
24

ovid

direct-style JavaScript CFA
Haskell
4
star
25

pyret-npm

JavaScript
3
star
26

ProgressiveTypes

Coq
3
star
27

pretty-fast-pretty-printer

A simple, linear-time pretty printing library
JavaScript
3
star
28

pyret-lang-resugarer

A branch of Pyret supporting resugaring. (For Pyret's old Racket implementation.)
Racket
3
star
29

k3

Academic process collaboration
JavaScript
2
star
30

strobe-old

Original Haskell implementation of Strobe
Haskell
2
star
31

pyret.org

The site for pyret.org
Prolog
2
star
32

webbits-html

JavaScript
2
star
33

Alloy-Ex

Clojure
2
star
34

testfest

JavaScript
2
star
35

lambdajs-coq

Coq
2
star
36

atom-language-pyret

Pyret language support for Atom
2
star
37

DOM-Semantics

Racket
2
star
38

Resume

Faculty search.
JavaScript
2
star
39

anchor

JavaScript
1
star
40

pyret-editor-backend

A server and client skeleton for interactively compiling Pyret code from a web browser.
JavaScript
1
star
41

powder-monkey

Utilities for orchestrating massive automated evaluations of Pyret programs.
JavaScript
1
star
42

iticse-in-flow-2014

Documents for working group on in-flow peer review at ITiCSE 2014 (http://iticse2014.it.uu.se/workinggroups.php#methodology)
Racket
1
star
43

flapjax-lang.org

JavaScript
1
star
44

piton

Formal models exploring identity and capabilities.
1
star
45

Apply

Graduate admissions
JavaScript
1
star
46

shim

Temporary storage for Particle core shim and tutorial doc
Arduino
1
star
47

smol-to-others

Translate SMoL programs to other programming languages
Racket
1
star
48

chaff-gen-artifacts

Artifacts for Conceptual Mutation Testing
Pyret
1
star
49

jswebtools.org

HTML
1
star
50

LTLTutor

Misconception-based tutor designed to help people learn Linear Temporal Logic.
Python
1
star
51

smol-translator

Translate SMoL programs to other programming languages
JavaScript
1
star