wisp
 

Wisp: Whitespace to Lisp

define : hello                    (define (hello)
  display "Hello World"     ⇒        (display "Hello World"))

Changes (full changelog)

(Arne Babenhauserheide)
2017-11-23: update NEWS tip

update NEWS

(Arne Babenhauserheide)
2017-11-23: make distcheck works again

make distcheck works again

(Arne Babenhauserheide)
2017-11-23: make wisp.scm executable and provide it as wisp2lisp

make wisp.scm executable and provide it as wisp2lisp

(Arne Babenhauserheide)
2017-11-18: examples: update fizzbuzz.w hello-world-server.w macros.w

examples: update fizzbuzz.w hello-world-server.w macros.w running_mean_std.w tinyenc.w

Branches

(Arne Babenhauserheide)
stable: Added signature for changeset 9f9a745bd50c 2017-11-10

Added signature for changeset 9f9a745bd50c

(Arne Babenhauserheide)
limited-multiline-colon-parens: merge default into limited-multiline-colon-parens. 2016-07-20

merge default into limited-multiline-colon-parens.

(drak)
default: closed branch 2016-07-18

closed branch

(Arne Babenhauserheide)
default: update NEWS tip 2017-11-23

update NEWS

Tags

(Arne Babenhauserheide)
v0.9.8: merge install fix stable 2017-11-10

merge install fix

(Arne Babenhauserheide)
v0.9.7: install language/wisp.scm + debugging stable 2017-10-17

install language/wisp.scm + debugging

(Arne Babenhauserheide)
v0.9.6: warn about partial unindent stable 2017-10-08

warn about partial unindent

(Arne Babenhauserheide)
v0.9.5: self-contained language/wisp and fixed partial un-indent stable 2017-09-25

self-contained language/wisp and fixed partial un-indent

(Arne Babenhauserheide)
v0.9.4: realpath on OSX, guile/site/... and r7rs bench stable 2017-09-19

realpath on OSX, guile/site/... and r7rs bench

(Arne Babenhauserheide)
v0.9.3: include m4/guile.m4 to fix version-mismatches stable 2017-09-18

include m4/guile.m4 to fix version-mismatches

(Arne Babenhauserheide)
v0.9.2: merge 10 more examples and polish stable 2017-08-20

merge 10 more examples and polish

(Arne Babenhauserheide)
v0.9.1: merge new examples, autotools work, slides and bugfixes. stable 2016-07-12

merge new examples, autotools work, slides and bugfixes.

(Arne Babenhauserheide)
v0.9.0: merge starting from wisp.scm stable 2015-09-24

merge starting from wisp.scm

(Arne Babenhauserheide)
v0.8.7: prepare wisp 0.8.7 2015-09-24

prepare wisp 0.8.7

(Arne Babenhauserheide)
v0.8.6: prepared for release 0.8.6 2015-09-12

prepared for release 0.8.6

(Arne Babenhauserheide)
v0.8.5: merge : . and SRFI-119. stable 2015-07-28

merge : . and SRFI-119.

(Arne Babenhauserheide)
wisp-mode-0.2.1: wisp-mode 0.2.1 2015-06-23

wisp-mode 0.2.1

(Arne Babenhauserheide)
v0.8.4: merge no longer wrapping blocks in begin, wisp-mode without electric stable 2015-06-23

merge no longer wrapping blocks in begin, wisp-mode without electric indent and examples newbase60 and cli.

(Arne Babenhauserheide)
v0.8.3: merge source-properties and d20world experiment. stable 2015-04-11

merge source-properties and d20world experiment.

(Arne Babenhauserheide)
v0.8.2: merge SRFI draft, curly-infix by default, REPL delayed output fix, stable 2015-03-19

merge SRFI draft, curly-infix by default, REPL delayed output fix, examples, tests and generalized shell-call.

(drak)
v0.8.1: merge for release: reader execution and SRFI. stable 2014-11-19

merge for release: reader execution and SRFI. - wisp-reader: fix wisp-scheme code-tree evaluation - SRFI: lots of polish.

(Arne Babenhauserheide)
v0.8.0: full featured wisp using the scheme (read) which passes the stable 2014-11-06

full featured wisp using the scheme (read) which passes the testsuite. Requires curly infix now.

(Arne Babenhauserheide)
v0.6.6: hotfix bootstrap.sh stable 2014-10-16

hotfix bootstrap.sh

(Arne Babenhauserheide)
v0.6.5: v0.6.5 now uses the clean scheme read using wisp in the REPL. stable 2014-10-16

v0.6.5 now uses the clean scheme read using wisp in the REPL.

(Arne Babenhauserheide)
v0.6.4: this is the actual wisp-scheme. stable 2014-09-02

this is the actual wisp-scheme.

(Arne Babenhauserheide)
v0.6.3: increment version for Makefile fix. stable 2014-09-02

increment version for Makefile fix.

(Arne Babenhauserheide)
v0.6.2: release 0.6.2 - mainly an actually working wisp implementation for stable 2014-09-02

release 0.6.2 - mainly an actually working wisp implementation for scheme (only) which uses the guile reader. This should be actually correct for scheme. And match-magic ☺

(Arne Babenhauserheide)
v0.6.1: merge default for release: simpler unicode handling and honor stable 2014-08-07

merge default for release: simpler unicode handling and honor --quiet for bootstrapping.

(Arne Babenhauserheide)
v0.6.0: merge default into stable for release: stable 2014-07-14

merge default into stable for release: - Better performance - Support for SRFI-105 - Working syntax highlighting in export via wisp-mode.el - Wisp can now execute wisp-files directly via guile -L . --language=wisp file.w. - Icosahedric Advection-Diffusion example: examples/d20world.w - Draft for an SRFI - Presentatien: Why Wisp? - Working autoreconf -i; ./configure; make distcheck - Real Testsuite (./runtests.sh . .)

(Arne Babenhauserheide)
wisp-mode-0.2: release wisp-mode 0.2: Fixed the regular expressions. Now org-mode stable 2014-03-12

release wisp-mode 0.2: Fixed the regular expressions. Now org-mode HTML export works with wisp-code.

(Arne Babenhauserheide)
v0.5.11: merge default into stable stable 2014-02-23

merge default into stable

(Arne Babenhauserheide)
v0.5.10: mark bug as resolved 2014-02-08

mark bug as resolved

(Arne Babenhauserheide)
v0.5.9: merge default into stable stable 2014-01-22

merge default into stable

(Arne Babenhauserheide)
v0.5.8: merge default into stable stable 2014-01-22

merge default into stable

(Arne Babenhauserheide)
v0.5.7: merge default into stable. stable 2014-01-22

merge default into stable.

(Arne Babenhauserheide)
v0.5.6: merge repl into stable. stable 2014-01-22

merge repl into stable.

(Arne Babenhauserheide)
v0.5.5: merge default into stable for release. stable 2014-01-22

merge default into stable for release.

(Arne Babenhauserheide)
v0.5.4: we now have a real testsuite. 2014-01-22

we now have a real testsuite.

(Arne Babenhauserheide)
v0.5.3: Integrated bootstrapping with autotools. 2014-01-08

Integrated bootstrapping with autotools.

(Arne Babenhauserheide)
v0.5.2: make files containing only a hashbang work 2014-01-07

make files containing only a hashbang work

(Arne Babenhauserheide)
v0.5.1: resolved bug for general paren-prefixes (since it’s solved). 2014-01-07

resolved bug for general paren-prefixes (since it’s solved).

(Arne Babenhauserheide)
v0.5: remove debugging output. 2013-09-13

remove debugging output.

(Arne Babenhauserheide)
v0.4: aside from some necessary workarounds (check for FIXME in the file), 2013-09-10

aside from some necessary workarounds (check for FIXME in the file), wisp-guile.w can now parse itself: python3 wisp.py wisp-guile.w > wisp-guile.scm && guile wisp-guile.scm wisp-guile.w > 1 guile 1 wisp-guile.w > 2 diff 1 2 YAY

(Arne Babenhauserheide)
v0.3.1: FIX: comments containing a closing parenthesis could break the 2013-08-08

FIX: comments containing a closing parenthesis could break the parser → the linebreak-killing-code in brackets had to be aware of comments.

(Arne Babenhauserheide)
v0.3: increase wisp-multiline version to 0.3 2013-07-24

increase wisp-multiline version to 0.3

(Arne Babenhauserheide)
v0.2: take code from stdin with the argument - and save it to a file with 2013-03-26

take code from stdin with the argument - and save it to a file with the option -o FILE.

(Arne Babenhauserheide)
v0.1: added inline : to the example. 2013-03-21

added inline : to the example.

Readme

Wisp: Whitespace to Lisp

define : hello                    (define (hello)
  display "Hello World"     ⇒        (display "Hello World"))

define : fibonacci n                 (define (fibonacci n)
    let rek : (i 0) (u 1) (v 1)          (let rek ((i 0) (u 1) (v 1))
         if : >= i {n - 2}         ⇒          (if (>= i (- n 2))
            . v                                    v
            rek {i + 1} v {u + v}                 (rek (+ i 1) v (+ u v)))))

Wisp turns indentation based syntax into Lisp. The conversion is homoiconic3, generic4, and backwards-compatible5. It is inspired by project readable, but tries to keep itself simple (and stupid: just add parens for indentation).

More information is available on the wisp-website, and code in the wisp-repository.

For a short presentation, see Why Wisp?

Note that this is full-fledged scheme, with all its capabilities like hygienic macros (programmable syntax!) and full tail recursion.

Requirements

Setup

From the repository:

  • Get wisp: hg clone http://draketo.de/proj/wisp (needs Mercurial)
  • Bootstrap: cd wisp && autoreconf -i && ./configure && make

From a release:

Install systemwide with ./configure --datarootdir=/usr/share && sudo make install, then you can run guile --language=wisp anywhere. Install in your home folder with ./configure --datarootdir=$HOME/.local; make install. Use guile -c '(import (language wisp spec))' to get rid of auto-compile errors.

Run tests with make check. Distribute your own version with make distcheck.

If your Guile is installed in your home, you might need to use ./configure PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig/ and make distcheck PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig/

The same might apply for Guile in /usr/local/: you might have to use PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

Usage

  • Preprocess files: guile ./wisp.scm infile.wisp > outfile.scm
  • Wisp at the REPL: guile -L . --language=wisp # in the wisp-folder
  • The files in examples/ show how to make executable wisp programs.

Wisp and curly infix (SRFI-105)

Wisp treats braces "{}" the same as parentheses "()" and square brackets "[]", so you can use it with curly infix (SRFI-105) to get more customary math expressions. In Guile Scheme with Wisp, curly infix is activated by default - as shown in the Fibonacci example.

If you want to use a curly-infix expression starting a line, you have to prefix it with a dot:

. {1 + 1}
; = 2

Notes

Standardization: Wisp is standardized as SRFI 11912.

Copyright: 2013--2015 Arne Babenhauserheide

License: GPLv3 or later


  1. SRFI is the abbreviation of Scheme Request for Implementation. It is the official schemisch way of suggesting new features. SRFIs are maintained at srfi.schemers.org/

  2. It is “A SRFI”, not “An SRFI”, because SRFI is spoken as “surfie” and as such its spoken form does not begin with a vowel. 

  3. Wisp is homoiconic because everything you write gets turned into lisp which is homoiconic. 

  4. Wisp is generic, because it works for any language which uses brackets to start a function call - which is true for most lisps. You simply get rid of the speerwall of parentheses without losing their power. 

  5. Wisp is backwards compatible, because you can use arbitrary lisp code in wisp: Indentation processing skips expressions in brackets.