Skip to content

Commit d3a09ee

Browse files
committed
showcase 1.0 Beta version
1 parent 2bf2bcd commit d3a09ee

File tree

4 files changed

+101
-106
lines changed

4 files changed

+101
-106
lines changed

docs.html

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<![endif]-->
2020
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin/>
2121
<link href="https://cdn.jsdelivr.net/combine/npm/jquery.terminal/css/jquery.terminal.min.css,npm/terminal-prism/css/prism-coy.css" rel="stylesheet"/>
22+
<link href="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta/lib/css/terminal.css" rel="stylesheet"/>
2223
<link href="./examples/common.css" rel="stylesheet"/>
2324
<link href="style.css" rel="stylesheet"/>
2425
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/>

head.html

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<![endif]-->
1313
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin/>
1414
<link href="https://cdn.jsdelivr.net/combine/npm/jquery.terminal/css/jquery.terminal.min.css,npm/terminal-prism/css/prism-coy.css" rel="stylesheet"/>
15+
<link href="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta/lib/css/terminal.css" rel="stylesheet"/>
1516
<link href="./examples/common.css" rel="stylesheet"/>
1617
<link href="style.css" rel="stylesheet"/>
1718
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/>

index.html

+50-53
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<![endif]-->
2020
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin/>
2121
<link href="https://cdn.jsdelivr.net/combine/npm/jquery.terminal/css/jquery.terminal.min.css,npm/terminal-prism/css/prism-coy.css" rel="stylesheet"/>
22+
<link href="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta/lib/css/terminal.css" rel="stylesheet"/>
2223
<link href="./examples/common.css" rel="stylesheet"/>
2324
<link href="style.css" rel="stylesheet"/>
2425
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/>
@@ -85,25 +86,21 @@ <h1>
8586
<p>LIPS is poweful Scheme based lisp language written in JavaScript. The name is recursive acronym which stands for LIPS is Pretty Simple. The interpreter have very good integration with JavaScript.</p>
8687
<p>Key features of the interpreter:</p>
8788
<ul>
88-
<li>Implementation of Lisp Macros, backquote and macroexpand,</li>
89-
<li>Runs in Browser and NodeJS,</li>
90-
<li>Familiar Scheme like Syntax,</li>
91-
<li>Functions in LIPS are normal javascript functions,</li>
92-
<li>Builtin documentation for macros and functions (use help in REPL),</li>
93-
<li>Library agnostic with almost no dependencies,</li>
94-
<li>You can invoke native JavaScript functions and methods from LIPS,</li>
95-
<li>Promises are treated as values they resolve to (so async code look like sync - like auto <code><strong>async/await</strong></code>),</li>
96-
<li>Easy extension using JavaScript using Macros or functions,</li>
97-
<li>Regexes are first class objects same as macros that are resolved at runtime,</li>
98-
<li>BigInt support (for browsers that don't have native support you will need <a href="https://github.com/indutny/bn.js/">bn.js</a>),</li>
99-
<li>Optional dynamic scope (like in Emacs Lisp),</li>
100-
<li>Node.js and Web based Interpreter (REPL).</li>
89+
<li>Literal regular expression.</li>
90+
<li>Great integration with JavaScript.</li>
91+
<li>Asynchronous execution (auto resolving of promises).</li>
92+
<li>Possibility to add new syntax (similar to vectors and object).</li>
93+
<li>Numerical tower and Big Integer support.</li>
94+
<li>Powerful introspection.</li>
95+
<li>Auto formatting lisp of code (pretty print)</li>
96+
<li>Lisp and hygienic Scheme macros and macroexpand.</li>
97+
<li>Builtin help system.</li>
10198
</ul>
10299
</section>
103100
<section id="demo">
104-
<header><h2>Demo</h2></header>
105-
<p>Check <a href="https://github.com/jcubic/lips/wiki/Getting-Started">Getting Started Guide</a> and
106-
try the interpreter while you will read the document.</p>
101+
<header id="beta"><h2>1.0.0 Beta Demo</h2></header>
102+
<p>Check <a href="https://github.com/jcubic/lips/wiki/Everything-you-need-to-know-about-Scheme">Everything you need to know about Scheme</a> and try the interpreter while you will read the document.</p>
103+
<p>You can also look at <a href="https://github.com/jcubic/lips/wiki/v1.0.0">Doumentation for 1.0.0</a> (WIP).</p>
107104
<div class="tabs">
108105
<ul>
109106
<li><a href="#">lexical</a></li>
@@ -117,10 +114,6 @@ <h1>
117114
</div>
118115
</div>
119116
</section>
120-
<section id="beta">
121-
<header><h2>1.0.0 Beta version</h2></header>
122-
<p>To test latest beta implementation of the interpreter, check <a href="/beta.html">LIPS Beta Demo</a>. Documentation (WIP) for version 1.0.0 can be found on <a href="https://github.com/jcubic/lips/wiki/v1.0">Wiki</a>.</p>
123-
</section>
124117
<section id="bookmark">
125118
<header><h2>Bookmarklet</h2></header>
126119
<p>When you're learning Scheme language, you can run the REPL directly on any page that
@@ -149,25 +142,27 @@ <h1>
149142
<p>When using LIPS interpreter in browser you need to include the main script file.</p>
150143
<p>If you want to use Webpack see <a href="https://github.com/jcubic/lips/wiki/Webpack">wiki page</a> for details.</p>
151144
<pre><code class="language-markup">
152-
&lt;script src="https://unpkg.com/@jcubic/lips"&gt;&lt;/script&gt;
145+
&lt;script src="https://unpkg.com/@jcubic/lips@beta/dist/lips.min.js"&gt;&lt;/script&gt;
146+
</code></pre>
147+
<p>or jsDelivr that is somewhat faster:</p>
148+
<pre><code class="language-markup">
149+
&lt;script src="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta/dist/lips.min.js"&gt;&lt;/script&gt;
153150
</code></pre>
154151
<p>You can put LIPS code directly in script tag:</p>
155152
<pre><code class="language-markup">
156-
&lt;script type="text/x-lips"&gt;
157-
(print "hello")
158-
;; this will load and evaluate external file
159-
(load "example.lips")
160-
&lt;script&gt;
153+
&lt;script type="text/x-scheme" bootstrap&gt;
154+
(let ((what "world")
155+
(greet "hello"))
156+
(display (string-append "hello" " " what)))
157+
&lt;/script&gt;
161158
</code></pre>
159+
<p><strong>NOTE:</strong> If you want to load started library, you should use boostrap attribute that will load it for you. You can optionaly specify the location of the files.</p>
162160
<p>You can also use src attribute to link to source file.</p>
163161
<pre><code class="language-html">
164-
&lt;script type="text/x-lips" src="example.lips"&gt;&lt;script&gt;
162+
&lt;script type="text/x-scheme" src="example.lips"&gt;&lt;script&gt;
165163
</code></pre>
166164
<header><h2>Node</h2></header>
167-
<pre><code class="language-bash">
168-
npm install -g @jcubic/lips
169-
</code></pre>
170-
<p>To install 1.0.0 beta version use:</p>
165+
<img src="https://github.com/jcubic/lips/raw/master/assets/screencast.gif?raw=true" alt="Terminal with LIPS Scheme interprer"/>
171166
<pre><code class="language-bash">
172167
npm install -g @jcubic/lips@beta
173168
</code></pre>
@@ -176,19 +171,19 @@ <h1>
176171
lips
177172
lips foo.lips
178173
## you can also run code as string
179-
lips -c '(print "hello world")'
174+
lips -e '(print "hello world")'
180175
</code></pre>
181176
<p>You can also write scripts using LIPS with <a href="https://en.wikipedia.org/wiki/Shebang_(Unix)">shebang</a></p>
182-
<p>Crete file foo.lips</p>
177+
<p>Crete file foo.scm</p>
183178
<pre><code class="language-scheme">
184179
#!/usr/bin/env lips
185180
(let ((what "World"))
186-
(print (concat "Hello " what)))
181+
(print (string-append "Hello " what)))
187182
</code></pre>
188183
<p>Then run</p>
189184
<pre><code class="language-bash">
190-
chmod a+x foo.lips
191-
./foo.lips # or just foo.lips depend on your $PATH
185+
chmod a+x foo.scm
186+
./foo.scm # or just foo.lips depend on your $PATH
192187
</code></pre>
193188
<header><h2>Direct API</h2></header>
194189
<p>You can also run execute LIPS programaticaly (in Node.js/Webpack).</p>
@@ -199,10 +194,12 @@ <h1>
199194
</code></pre>
200195
<p>Then use it like this:</p>
201196
<pre><code class="language-javascript">
202-
lips.exec("(let ((a 10) (b 20)) (* a b))").then(result => {
203-
// result is always array
204-
const [value] = result;
205-
console.log(value);
197+
lips.exec('(let ((a 10) (b 20)) (* a b))').then(result => {
198+
results.forEach(function(result) {
199+
if (typeof result !== 'undefined') {
200+
console.log(result.toString());
201+
}
202+
});
206203
});
207204
</code></pre>
208205
</section>
@@ -227,13 +224,10 @@ <h1>
227224
</footer>
228225

229226
<script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>
230-
<script src="https://cdn.jsdelivr.net/npm/@jcubic/lips/dist/lips.min.js"></script>
231-
<!-- <script src="./src/lips.js"></script> -->
227+
<script src="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta/dist/lips.min.js" bootstrap="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta"></script>
232228
<script src="https://cdn.jsdelivr.net/combine/npm/jquery,npm/jquery.terminal/js/jquery.terminal.min.js,npm/js-polyfills/keyboard.js,npm/prismjs/prism.js,npm/jquery.terminal/js/prism.js,npm/prismjs/components/prism-scheme.min.js,npm/prismjs/components/prism-javascript.min.js,npm/prismjs/components/prism-markup.min.js,npm/prismjs/components/prism-bash.min.js"></script>
233-
<!-- use after 1.0
234-
npm/@jcubic/lips@beta/lib/js/terminal.js,npm/@jcubic/lips@beta/lib/js/prism.js -->
235-
<script src="./examples/terminal.js"></script>
236-
<script src="./examples/prism.js"></script>
229+
<script src="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta/lib/js/terminal.js"></script>
230+
<script src="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta/lib/js/prism.js"></script>
237231
<style>
238232
.token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string {
239233
background: inherit;
@@ -250,11 +244,16 @@ <h1>
250244
<script>
251245
function interpreter(selector, dynamic) {
252246
var term = terminal({ selector, dynamic, name: 'demo', lips });
253-
term.echo('LIPS Demo version ' + lips.version + ' with [[b;#fff;]' +
254-
(dynamic ? 'dynamic' : 'lexical') + ' scope]\n' +
255-
'type [[b;#fff;](env)] to see environment with ' +
256-
'functions macros and variables\nYou can also use [[b;#fff;](help obj)]' +
257-
' to display help for specic function or macro.\n', { formatters: false });
247+
var banner = 'LIPS Demo version ' + lips.version + ' with [[b;#fff;]' +
248+
(dynamic ? 'dynamic' : 'lexical') + ' scope]\ntype (env) to see ' +
249+
'environment with functions macros and variables\nYou can also u' +
250+
'se (help obj) to display help for specic function or macro.\nUs' +
251+
'e (dir name) to get list of JavaScript properties and (apropos ' +
252+
'name)\nto display list of matched names in environment.\n';
253+
banner = banner.replace(/(\((?:env|dir|help|apropos)[^)]*\))/g, function(code) {
254+
return $.terminal.prism("scheme", code, {echo: true});
255+
});
256+
term.echo(banner, { formatters: false });
258257
}
259258
$(function() {
260259

@@ -281,7 +280,5 @@ <h1>
281280
});
282281
});
283282
</script>
284-
<script type="text/x-lips" src="examples/helpers.lips"></script>
285-
<script type="text/x-lips" src="examples/defstruct.lips"></script>
286283
</body>
287284
</html>

index.tmpl

+49-53
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,21 @@
1111
<p>LIPS is poweful Scheme based lisp language written in JavaScript. The name is recursive acronym which stands for LIPS is Pretty Simple. The interpreter have very good integration with JavaScript.</p>
1212
<p>Key features of the interpreter:</p>
1313
<ul>
14-
<li>Implementation of Lisp Macros, backquote and macroexpand,</li>
15-
<li>Runs in Browser and NodeJS,</li>
16-
<li>Familiar Scheme like Syntax,</li>
17-
<li>Functions in LIPS are normal javascript functions,</li>
18-
<li>Builtin documentation for macros and functions (use help in REPL),</li>
19-
<li>Library agnostic with almost no dependencies,</li>
20-
<li>You can invoke native JavaScript functions and methods from LIPS,</li>
21-
<li>Promises are treated as values they resolve to (so async code look like sync - like auto <code><strong>async/await</strong></code>),</li>
22-
<li>Easy extension using JavaScript using Macros or functions,</li>
23-
<li>Regexes are first class objects same as macros that are resolved at runtime,</li>
24-
<li>BigInt support (for browsers that don't have native support you will need <a href="https://github.com/indutny/bn.js/">bn.js</a>),</li>
25-
<li>Optional dynamic scope (like in Emacs Lisp),</li>
26-
<li>Node.js and Web based Interpreter (REPL).</li>
14+
<li>Literal regular expression.</li>
15+
<li>Great integration with JavaScript.</li>
16+
<li>Asynchronous execution (auto resolving of promises).</li>
17+
<li>Possibility to add new syntax (similar to vectors and object).</li>
18+
<li>Numerical tower and Big Integer support.</li>
19+
<li>Powerful introspection.</li>
20+
<li>Auto formatting lisp of code (pretty print)</li>
21+
<li>Lisp and hygienic Scheme macros and macroexpand.</li>
22+
<li>Builtin help system.</li>
2723
</ul>
2824
</section>
2925
<section id="demo">
30-
<header><h2>Demo</h2></header>
31-
<p>Check <a href="https://github.com/jcubic/lips/wiki/Getting-Started">Getting Started Guide</a> and
32-
try the interpreter while you will read the document.</p>
26+
<header id="beta"><h2>1.0.0 Beta Demo</h2></header>
27+
<p>Check <a href="https://github.com/jcubic/lips/wiki/Everything-you-need-to-know-about-Scheme">Everything you need to know about Scheme</a> and try the interpreter while you will read the document.</p>
28+
<p>You can also look at <a href="https://github.com/jcubic/lips/wiki/v1.0.0">Doumentation for 1.0.0</a> (WIP).</p>
3329
<div class="tabs">
3430
<ul>
3531
<li><a href="#">lexical</a></li>
@@ -43,10 +39,6 @@
4339
</div>
4440
</div>
4541
</section>
46-
<section id="beta">
47-
<header><h2>1.0.0 Beta version</h2></header>
48-
<p>To test latest beta implementation of the interpreter, check <a href="/beta.html">LIPS Beta Demo</a>. Documentation (WIP) for version 1.0.0 can be found on <a href="https://github.com/jcubic/lips/wiki/v1.0">Wiki</a>.</p>
49-
</section>
5042
<section id="bookmark">
5143
<header><h2>Bookmarklet</h2></header>
5244
<p>When you're learning Scheme language, you can run the REPL directly on any page that
@@ -75,25 +67,27 @@
7567
<p>When using LIPS interpreter in browser you need to include the main script file.</p>
7668
<p>If you want to use Webpack see <a href="https://github.com/jcubic/lips/wiki/Webpack">wiki page</a> for details.</p>
7769
<pre><code class="language-markup">
78-
&lt;script src="https://unpkg.com/@jcubic/lips"&gt;&lt;/script&gt;
70+
&lt;script src="https://unpkg.com/@jcubic/lips@beta/dist/lips.min.js"&gt;&lt;/script&gt;
71+
</code></pre>
72+
<p>or jsDelivr that is somewhat faster:</p>
73+
<pre><code class="language-markup">
74+
&lt;script src="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta/dist/lips.min.js"&gt;&lt;/script&gt;
7975
</code></pre>
8076
<p>You can put LIPS code directly in script tag:</p>
8177
<pre><code class="language-markup">
82-
&lt;script type="text/x-lips"&gt;
83-
(print "hello")
84-
;; this will load and evaluate external file
85-
(load "example.lips")
86-
&lt;script&gt;
78+
&lt;script type="text/x-scheme" bootstrap&gt;
79+
(let ((what "world")
80+
(greet "hello"))
81+
(display (string-append "hello" " " what)))
82+
&lt;/script&gt;
8783
</code></pre>
84+
<p><strong>NOTE:</strong> If you want to load started library, you should use boostrap attribute that will load it for you. You can optionaly specify the location of the files.</p>
8885
<p>You can also use src attribute to link to source file.</p>
8986
<pre><code class="language-html">
90-
&lt;script type="text/x-lips" src="example.lips"&gt;&lt;script&gt;
87+
&lt;script type="text/x-scheme" src="example.lips"&gt;&lt;script&gt;
9188
</code></pre>
9289
<header><h2>Node</h2></header>
93-
<pre><code class="language-bash">
94-
npm install -g @jcubic/lips
95-
</code></pre>
96-
<p>To install 1.0.0 beta version use:</p>
90+
<img src="https://github.com/jcubic/lips/raw/master/assets/screencast.gif?raw=true" alt="Terminal with LIPS Scheme interprer"/>
9791
<pre><code class="language-bash">
9892
npm install -g @jcubic/lips@beta
9993
</code></pre>
@@ -102,19 +96,19 @@ npm install -g @jcubic/lips@beta
10296
lips
10397
lips foo.lips
10498
## you can also run code as string
105-
lips -c '(print "hello world")'
99+
lips -e '(print "hello world")'
106100
</code></pre>
107101
<p>You can also write scripts using LIPS with <a href="https://en.wikipedia.org/wiki/Shebang_(Unix)">shebang</a></p>
108-
<p>Crete file foo.lips</p>
102+
<p>Crete file foo.scm</p>
109103
<pre><code class="language-scheme">
110104
#!/usr/bin/env lips
111105
(let ((what "World"))
112-
(print (concat "Hello " what)))
106+
(print (string-append "Hello " what)))
113107
</code></pre>
114108
<p>Then run</p>
115109
<pre><code class="language-bash">
116-
chmod a+x foo.lips
117-
./foo.lips # or just foo.lips depend on your $PATH
110+
chmod a+x foo.scm
111+
./foo.scm # or just foo.lips depend on your $PATH
118112
</code></pre>
119113
<header><h2>Direct API</h2></header>
120114
<p>You can also run execute LIPS programaticaly (in Node.js/Webpack).</p>
@@ -125,22 +119,21 @@ import lips from '@jcubic/lips';
125119
</code></pre>
126120
<p>Then use it like this:</p>
127121
<pre><code class="language-javascript">
128-
lips.exec("(let ((a 10) (b 20)) (* a b))").then(result => {
129-
// result is always array
130-
const [value] = result;
131-
console.log(value);
122+
lips.exec('(let ((a 10) (b 20)) (* a b))').then(result => {
123+
results.forEach(function(result) {
124+
if (typeof result !== 'undefined') {
125+
console.log(result.toString());
126+
}
127+
});
132128
});
133129
</code></pre>
134130
</section>
135131
{{FOOTER}}
136132
<script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>
137-
<script src="https://cdn.jsdelivr.net/npm/@jcubic/lips/dist/lips.min.js"></script>
138-
<!-- <script src="./src/lips.js"></script> -->
133+
<script src="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta/dist/lips.min.js" bootstrap="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta"></script>
139134
<script src="https://cdn.jsdelivr.net/combine/npm/jquery,npm/jquery.terminal/js/jquery.terminal.min.js,npm/js-polyfills/keyboard.js,npm/prismjs/prism.js,npm/jquery.terminal/js/prism.js,npm/prismjs/components/prism-scheme.min.js,npm/prismjs/components/prism-javascript.min.js,npm/prismjs/components/prism-markup.min.js,npm/prismjs/components/prism-bash.min.js"></script>
140-
<!-- use after 1.0
141-
npm/@jcubic/lips@beta/lib/js/terminal.js,npm/@jcubic/lips@beta/lib/js/prism.js -->
142-
<script src="./examples/terminal.js"></script>
143-
<script src="./examples/prism.js"></script>
135+
<script src="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta/lib/js/terminal.js"></script>
136+
<script src="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta/lib/js/prism.js"></script>
144137
<style>
145138
.token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string {
146139
background: inherit;
@@ -157,11 +150,16 @@ lips.exec("(let ((a 10) (b 20)) (* a b))").then(result => {
157150
<script>
158151
function interpreter(selector, dynamic) {
159152
var term = terminal({ selector, dynamic, name: 'demo', lips });
160-
term.echo('LIPS Demo version ' + lips.version + ' with [[b;#fff;]' +
161-
(dynamic ? 'dynamic' : 'lexical') + ' scope]\n' +
162-
'type [[b;#fff;](env)] to see environment with ' +
163-
'functions macros and variables\nYou can also use [[b;#fff;](help obj)]' +
164-
' to display help for specic function or macro.\n', { formatters: false });
153+
var banner = 'LIPS Demo version ' + lips.version + ' with [[b;#fff;]' +
154+
(dynamic ? 'dynamic' : 'lexical') + ' scope]\ntype (env) to see ' +
155+
'environment with functions macros and variables\nYou can also u' +
156+
'se (help obj) to display help for specic function or macro.\nUs' +
157+
'e (dir name) to get list of JavaScript properties and (apropos ' +
158+
'name)\nto display list of matched names in environment.\n';
159+
banner = banner.replace(/(\((?:env|dir|help|apropos)[^)]*\))/g, function(code) {
160+
return $.terminal.prism("scheme", code, {echo: true});
161+
});
162+
term.echo(banner, { formatters: false });
165163
}
166164
$(function() {
167165

@@ -188,7 +186,5 @@ lips.exec("(let ((a 10) (b 20)) (* a b))").then(result => {
188186
});
189187
});
190188
</script>
191-
<script type="text/x-lips" src="examples/helpers.lips"></script>
192-
<script type="text/x-lips" src="examples/defstruct.lips"></script>
193189
</body>
194190
</html>

0 commit comments

Comments
 (0)