LIPS is poweful Scheme based lisp interpreter written in JavaScript. The name is recursive acronym which stands for LIPS Is Pretty Simple. The interpreter have very good integration with JavaScript.
Key features of the interpreter:
Check Everything you need to know about Scheme and try the interpreter while you will read the document.
You can also look at Doumentation for 1.0.0 (WIP).
When you're learning Scheme language, you can run the REPL directly on any page that have Scheme tutorial you're learning from. It even work with PDF files and new empty tab (at least in Chrome). Drag this link LIPS REPL to your bookmarks. When you click on the bookmark it will run the interpreter. You can also just click the link.
The bookmark can also be used to add REPL to your LIPS Web application.
It may also not work no sites that are protected with Content Security Policy
When using LIPS Scheme interpreter in browser you need to include the main script file.
If you want to use Webpack see wiki page for details.
<script src="https://unpkg.com/@jcubic/lips@beta/dist/lips.min.js"></script>
or jsDelivr that is somewhat faster:
<script src="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta/dist/lips.min.js"></script>
You can put LIPS code directly in script tag:
<script type="text/x-scheme" bootstrap>
(let ((what "world")
(greet "hello"))
(display (string-append "hello" " " what)))
</script>
NOTE: If you want to load standard library, you should use bootstrap attribute that will load it for you. You can optionaly specify the location of the file.
You can also use src attribute to link to source file.
<script type="text/x-scheme" src="example.scm"><script>
npm install -g @jcubic/lips@beta
## if installed as global just use
lips
lips foo.lips
## you can also run code as string
lips -e '(print "hello world")'
You can also write scripts using LIPS with shebang
Crete file foo.scm
#!/usr/bin/env lips
(let ((what "World"))
(print (string-append "Hello " what)))
Then run
chmod a+x foo.scm
./foo.scm # or just foo.lips depend on your $PATH
You can also run execute LIPS programaticaly (in Node.js/Webpack).
var lips = require('@jcubic/lips');
// or
import lips from '@jcubic/lips';
Then use it like this:
lips.exec('(let ((a 10) (b 20)) (* a b))').then(result => {
results.forEach(function(result) {
if (typeof result !== 'undefined') {
console.log(result.toString());
}
});
});