Skip to content

Commit

Permalink
save and refactor generating reference json file
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Mar 28, 2024
1 parent 5e1ab67 commit f31ffde
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 21 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ jobs:
- name: create version file
run: npm run version

- name: Build LIPS reference
run: npm run reference

- name: Build website
run: npm run build

Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ define ver_date
-e "s/{{YEAR}}/${YEAR}/" $(1) || $(SED) -i -e "s/{{VER}}/DEV/g" -e "s/{{DATE}}/$(DATE)/g" $(1)
endef

ALL: Makefile package.json .$(VERSION) assets/classDiagram.svg dist/base.js dist/lips.js dist/lips.esm.js dist/lips.min.js dist/lips.esm.min.js README.md dist/std.min.scm dist/std.xcb
ALL: Makefile package.json .$(VERSION) assets/classDiagram.svg dist/base.js dist/lips.js dist/lips.esm.js dist/lips.min.js dist/lips.esm.min.js README.md dist/std.min.scm dist/std.xcb docs/reference.json

dist/banner.js: src/banner.js src/lips.js .$(VERSION)
$(CP) src/banner.js dist/banner.js
Expand All @@ -62,6 +62,9 @@ dist/std.scm: lib/bootstrap.scm lib/R5RS.scm lib/byte-vectors.scm lib/R7RS.scm l
dist/std.xcb: dist/std.scm
$(LIPS) -t --bootstrap dist/std.scm -c -q dist/std.scm

docs/reference.json: dist/std.xcb src/lips.js
$(NODE) ./scripts/reference.js > docs/reference.json

dist/std.min.scm: dist/std.scm
$(LIPS) -t --bootstrap dist/std.scm ./scripts/minify.scm ./dist/std.scm > dist/std.min.scm

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<h1 align="center">
<img src="https://github.com/jcubic/lips/blob/devel/assets/lips.svg?raw=true"
<img src="https://github.com/jcubic/lips/blob/docusaurus/assets/lips.svg?raw=true"
alt="LIPS - Scheme Based Powerful Lisp Language" />
</h1>

[![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/lips_lang)](https://twitter.com/lips_lang)
[![npm](https://img.shields.io/badge/npm-1.0.0%E2%80%93beta.18.1-blue.svg)](https://www.npmjs.com/package/@jcubic/lips)
![1.0.0 Complete](https://img.shields.io/github/milestones/progress-percent/jcubic/lips/1?label=1.0.0%20Complete)
[![Build and test](https://github.com/jcubic/lips/actions/workflows/build.yaml/badge.svg?branch=devel&event=push)](https://github.com/jcubic/lips/actions/workflows/build.yaml)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/lips/badge.svg?branch=devel&d10e8d3a3a0f2e4c8dbb6717a10f4367)](https://coveralls.io/github/jcubic/lips?branch=devel)
[![Build and test](https://github.com/jcubic/lips/actions/workflows/build.yaml/badge.svg?branch=docusaurus&event=push)](https://github.com/jcubic/lips/actions/workflows/build.yaml)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/lips/badge.svg?branch=docusaurus&43d437d0f754f33d6feaceaa59b38693)](https://coveralls.io/github/jcubic/lips?branch=docusaurus)
[![Join Gitter Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jcubic/lips)
![NPM Download Count](https://img.shields.io/npm/dm/@jcubic/lips)
![JSDelivr Download count](https://img.shields.io/jsdelivr/npm/hm/@jcubic/lips)
Expand Down Expand Up @@ -162,7 +162,7 @@ npm install -g @jcubic/lips@beta

you can run the interpreter from the terminal:

![LIPS: Scheme interactive terminal](https://github.com/jcubic/lips/blob/devel/assets/screencast.gif?raw=true)
![LIPS: Scheme interactive terminal](https://github.com/jcubic/lips/blob/docusaurus/assets/screencast.gif?raw=true)


You can also run code in a string with:
Expand Down Expand Up @@ -201,7 +201,7 @@ Executables also return a S-Expression according to SRFI-176 use `lips --version

## FOSDEM'23 Presentation [Video]

[![FOSDEM 2023 - LIPS Scheme: Powerful introspection and extensibility](https://github.com/jcubic/lips/blob/devel/assets/fosdem-intro.png?raw=true)](https://fosdem.org/2023/schedule/event/lipsscheme/)
[![FOSDEM 2023 - LIPS Scheme: Powerful introspection and extensibility](https://github.com/jcubic/lips/blob/docusaurus/assets/fosdem-intro.png?raw=true)](https://fosdem.org/2023/schedule/event/lipsscheme/)

## Limitations

Expand All @@ -210,7 +210,7 @@ Because LIPS is tree walking interpreter, sometimes it may be slow. Especially i
process long arrays and use callback function. If the array is quite large each piece of code
inside the callback may slow down the processing. For example see:

script [reference.scm](https://github.com/jcubic/lips/blob/devel/scripts/reference.scm)
script [reference.scm](https://github.com/jcubic/lips/blob/docusaurus/scripts/reference.scm)

That generates reference documentation for all builtin functions and macros.
The slow part is `(names.sort name-compare)` (`Array::sort`) that take quite time to calculate,
Expand Down
3 changes: 0 additions & 3 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,3 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# LIPS
reference.json
3 changes: 1 addition & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc",
"version": "node version.mjs",
"reference": "node reference.mjs"
"version": "node version.mjs"
},
"dependencies": {
"@docusaurus/core": "3.1.0",
Expand Down
1 change: 1 addition & 0 deletions docs/reference.json

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions docs/reference.mjs → scripts/reference.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'fs/promises';

import { env, exec } from '../dist/lips.esm.js';
import { env, exec } from '../src/lips.js';

function skip_internal([name]) {
return name.match(/^%/) === null;
Expand All @@ -22,8 +22,5 @@ function get_docs_strings() {
}

exec('(let-env lips.env.__parent__ (load "../dist/std.xcb"))').then(() => {
const data = JSON.stringify(get_docs_strings());
return fs.writeFile('reference.json', data);
}).catch(e => {
console.log(e);
console.log(JSON.stringify(get_docs_strings()));
});
5 changes: 4 additions & 1 deletion templates/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ define ver_date
-e "s/{{YEAR}}/${YEAR}/" $(1) || $(SED) -i -e "s/{{VER}}/DEV/g" -e "s/{{DATE}}/$(DATE)/g" $(1)
endef

ALL: Makefile package.json .$(VERSION) assets/classDiagram.svg dist/base.js dist/lips.js dist/lips.esm.js dist/lips.min.js dist/lips.esm.min.js README.md dist/std.min.scm dist/std.xcb
ALL: Makefile package.json .$(VERSION) assets/classDiagram.svg dist/base.js dist/lips.js dist/lips.esm.js dist/lips.min.js dist/lips.esm.min.js README.md dist/std.min.scm dist/std.xcb docs/reference.json

dist/banner.js: src/banner.js src/lips.js .$(VERSION)
$(CP) src/banner.js dist/banner.js
Expand All @@ -62,6 +62,9 @@ dist/std.scm: lib/bootstrap.scm lib/R5RS.scm lib/byte-vectors.scm lib/R7RS.scm l
dist/std.xcb: dist/std.scm
$(LIPS) -t --bootstrap dist/std.scm -c -q dist/std.scm

docs/reference.json: dist/std.xcb src/lips.js
$(NODE) ./scripts/reference.js > docs/reference.json

dist/std.min.scm: dist/std.scm
$(LIPS) -t --bootstrap dist/std.scm ./scripts/minify.scm ./dist/std.scm > dist/std.min.scm

Expand Down

0 comments on commit f31ffde

Please sign in to comment.