All Projects → jcubic → Lips

jcubic / Lips

Licence: mit
Scheme based powerful lisp interpreter written in JavaScript

Programming Languages

javascript
184084 projects - #8 most used programming language
language
365 projects
scheme
763 projects
lisp
113 projects
macros
77 projects

Projects that are alternatives of or similar to Lips

Nodebook
Nodebook - Multi-Lang Web REPL + CLI Code runner
Stars: ✭ 1,521 (+1167.5%)
Mutual labels:  repl
Article
前端相关、CSS、JavaScript、工具、解决方案…相关文章
Stars: ✭ 116 (-3.33%)
Mutual labels:  promise
Cisp
A Common Lisp Interpreter Built in COBOL
Stars: ✭ 120 (+0%)
Mutual labels:  lisp-interpreter
Promise Queue Plus
Promise-based queue. Support timeout, retry and so on.
Stars: ✭ 113 (-5.83%)
Mutual labels:  promise
Telegram Clonebot
Simple Bot to clone Google Drive Files (or Folders) to your Team Drive[or Normal Drive]. P.S This is not a Mirror Bot. Enjoy ✌🏻
Stars: ✭ 114 (-5%)
Mutual labels:  repl
Yoctolisp
Tiny Scheme-like Lisp interpreter written in a weekend
Stars: ✭ 117 (-2.5%)
Mutual labels:  lisp-interpreter
Bookmarks
a simple self-hosted bookmarking app that can import bookmarks from delicious and chrome
Stars: ✭ 112 (-6.67%)
Mutual labels:  bookmarklet
Colordrop
Interactive Drag & Drop Coloring with Material Design Color palette
Stars: ✭ 120 (+0%)
Mutual labels:  bookmarklet
Swiftfortunewheel
The ultimate spinning wheel view that supports dynamic content and rich customization.
Stars: ✭ 114 (-5%)
Mutual labels:  dynamic
Bach
Compose your async functions with elegance.
Stars: ✭ 117 (-2.5%)
Mutual labels:  promise
Jdeferred
Java Deferred/Promise library similar to JQuery.
Stars: ✭ 1,483 (+1135.83%)
Mutual labels:  promise
Postmate
📭 A powerful, simple, promise-based postMessage library.
Stars: ✭ 1,638 (+1265%)
Mutual labels:  promise
Vectormaster
Dynamic control over vector drawables!
Stars: ✭ 1,540 (+1183.33%)
Mutual labels:  dynamic
Blizzard.js
A promise-based Node.JS library for the Blizzard Battle.net Community Platform API
Stars: ✭ 113 (-5.83%)
Mutual labels:  promise
Lice
A multi-paradigm programming language running on JVM
Stars: ✭ 120 (+0%)
Mutual labels:  lisp-interpreter
Brain
An esoteric programming language compiler on top of LLVM based on Brainfuck
Stars: ✭ 112 (-6.67%)
Mutual labels:  repl
Zousan
A Lightning Fast, Yet Very Small Promise A+ Compliant Implementation
Stars: ✭ 117 (-2.5%)
Mutual labels:  promise
Bull Repl
Bull / BullMQ queue command line REPL
Stars: ✭ 121 (+0.83%)
Mutual labels:  repl
Stop.js
🐦 The Promise base `setTimeout`, release your callback
Stars: ✭ 120 (+0%)
Mutual labels:  promise
N
Node.js REPL with lodash
Stars: ✭ 118 (-1.67%)
Mutual labels:  repl

LIPS - Scheme Based Powerful Lisp Language

npm 1.0.0 Complete travis Coverage Status Join Gitter Chat GitHub license GitHub stars Tweet NPM Download Count JSDelivr Download count

LIPS is a powerful Scheme-based, Lisp language written in JavaScript. It is based on the Scheme dialect and the R5RS/R7RS specifications. It has extensions to make it easier to interact with JavaScript. It work both in the browser and with Node.js.

The name is a recursive acronym which stands for LIPS Is Pretty Simple.

Demo

Demo

1.0 Beta demo

Features

  • Literal regular expression.
  • Asynchronous execution.
  • Possibility to add new syntax (similar to vectors and object).
  • Powerful introspection.
  • Great integration with JavaScript.
  • Auto formatting lisp of code (pretty print)
  • Lisp and hygienic Scheme macros and macroexpand.
  • Builtin help system.

Installation

To install you can use npm (or yarn)
NOTE: The version that is on NPM is heavily outdated, use beta version:

npm install @jcubic/[email protected]

or yarn:

yarn add @jcubic/[email protected]

then include the file in the script tag. You can grab the version from unpkg.com

https://unpkg.com/@jcubic/[email protected]

or from jsdelivery

https://cdn.jsdelivr.net/npm/@jcubic/[email protected]/dist/lips.min.js

Bookmarklet REPL

You can also run the REPL on any page while you learn Scheme using the bookmarklet:

https://github.com/jcubic/lips/blob/master/lib/js/bookmark.js

Create any link in your bookmarks, edit it and copy paste the content of that file. Affter you click on the link it will create the REPL at the bottom of the page. (NOTE: It may not work on every page because of content security policy; e.g. google.com or gihub.com)

If you have trouble with creating the bookmarklet you can open LISP Scheme home page where you can find a link that you can drag to your bookmarks.

Usage

The simplest way is to include the lips code in the script tag:

<script type="text/x-scheme" bootstrap>
(let ((what "world")
      (greet "hello"))
   (display (string-append "hello" " " what)))
</script>

or use the src attribute:

<script type="text/x-scheme" bootstrap src="example.scm"></script>

Bootstrapping Scheme system

Big part of LIPS is written in LIPS itself, but to use full power of LIPS you need to load those additional Scheme files. The easiest way is to add bootstrap attribute on first script tag with text/x-scheme type. By default it will use CDN from jsdelivr. To load each file using builtin load function (that will fetch the file using AJAX and evaluate it).

<script src="https://cdn.jsdelivr.net/npm/@jcubic/[email protected]/dist/lips.min.js" bootstrap></script>

Running LIPS programmatically

var {exec} = require('@jcubic/lips'); // node
// or
var {exec} = lips; // browser

exec(string).then(function(results) {
     results.forEach(function(result) {
        console.log(result.toString());
     });
});

When running exec you will also need to bootstrap the language and loaded files from /lib/ directory.

Documentation about beta version can be found in Wiki.

Standalone executable

NOTE: Executable don't require bootstrapping lib files.

If you install lips globally with:

npm install -g @jcubic/[email protected]

you can run the interpreter from the terminal:

LIPS: Scheme interactive terminal

You can also run code in a string with:

lips -c '(let ((what "World")) (display (string-append "Hello " what)))'

and you can run a file using:

cat > foo.scm <<EOF
(let ((what "World"))
  (display (string-append "Hello " what))
  (newline))
EOF

lips foo.scm

You can also write executable files that use lips using shebang (SRFI-22)

cat foo.scm
#!/usr/bin/env lips

(let ((what "World"))
  (display (string-append "Hello " what))
  (newline))

chmod a+x foo.scm
./foo.scm

Executables also return a S-Expression according to SRFI-176 use lips --version or lips -V.

Links

Roadmap

1.0

  • [x] Full support for R5RS
  • [ ] Full support for R7RS
  • [ ] Continuations.
  • [ ] Tail Call Optimization (TCO).
  • [ ] Fully tested Numerical Tower.
  • [ ] R7RS libraries (import/export/define-library).
  • [ ] All recursive function in JS don't consume stack.
  • [ ] Finish syntax-rules (ignore limitations of current approach).
    • [ ] Objects.
    • [ ] Vectors.

1.1

  • [ ] Proper expansion time for both macro system.
  • [ ] Fully working and tested R7RS hygienic Macros (syntax-rules).

Acknowledgments

License

Released under MIT license
Copyright (c) 2018-2021 Jakub T. Jankiewicz

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].