rename uzu to mondo
This commit is contained in:
parent
b71b1354c3
commit
e3df504423
6 changed files with 29 additions and 29 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
# uzu
|
# mondo
|
||||||
|
|
||||||
an experimental parser for an *uzulang*, a custom dsl for patterns that can stand on its own feet. more info:
|
an experimental parser for an *uzulang*, a custom dsl for patterns that can stand on its own feet. more info:
|
||||||
|
|
||||||
|
|
@ -6,9 +6,9 @@ an experimental parser for an *uzulang*, a custom dsl for patterns that can stan
|
||||||
- [uzulang II](https://garten.salat.dev/uzu/uzulang2.html)
|
- [uzulang II](https://garten.salat.dev/uzu/uzulang2.html)
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import { UzuRunner } from 'uzu'
|
import { MondoRunner } from 'uzu'
|
||||||
|
|
||||||
const runner = UzuRunner({ seq, cat, s, crush, speed, '*': fast });
|
const runner = MondoRunner({ seq, cat, s, crush, speed, '*': fast });
|
||||||
const pat = runner.run('s [bd hh*2 cp.(crush 4) <mt ht lt>] . speed .8')
|
const pat = runner.run('s [bd hh*2 cp.(crush 4) <mt ht lt>] . speed .8')
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -26,4 +26,4 @@ the above code will create the following call structure:
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
you can pass all available functions to *UzuRunner* as an object.
|
you can pass all available functions to *MondoRunner* as an object.
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
/*
|
/*
|
||||||
uzu.mjs - <short description TODO>
|
mondo.mjs - <short description TODO>
|
||||||
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/mini/test/mini.test.mjs>
|
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/mini/test/mini.test.mjs>
|
||||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// evolved from https://garten.salat.dev/lisp/parser.html
|
// evolved from https://garten.salat.dev/lisp/parser.html
|
||||||
export class UzuParser {
|
export class MondoParser {
|
||||||
// these are the tokens we expect
|
// these are the tokens we expect
|
||||||
token_types = {
|
token_types = {
|
||||||
string: /^"(.*?)"/,
|
string: /^"(.*?)"/,
|
||||||
|
|
@ -251,9 +251,9 @@ export function printAst(ast, compact = false, lvl = 0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// lisp runner
|
// lisp runner
|
||||||
export class UzuRunner {
|
export class MondoRunner {
|
||||||
constructor(lib) {
|
constructor(lib) {
|
||||||
this.parser = new UzuParser();
|
this.parser = new MondoParser();
|
||||||
this.lib = lib;
|
this.lib = lib;
|
||||||
}
|
}
|
||||||
// a helper to check conditions and throw if they are not met
|
// a helper to check conditions and throw if they are not met
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"name": "uzu",
|
"name": "mondo",
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"description": "an uzu notation",
|
"description": "a language for functional composition that translates to js",
|
||||||
"main": "uzu.mjs",
|
"main": "mondo.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"main": "dist/uzu.mjs"
|
"main": "dist/mondo.mjs"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/tidalcycles/strudel/issues"
|
"url": "https://github.com/tidalcycles/strudel/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/tidalcycles/strudel/blob/main/packages/uzu/README.md",
|
"homepage": "https://github.com/tidalcycles/strudel/blob/main/packages/mondo/README.md",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vite": "^6.0.11",
|
"vite": "^6.0.11",
|
||||||
"vitest": "^3.0.4"
|
"vitest": "^3.0.4"
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
/*
|
/*
|
||||||
uzu.test.mjs - <short description TODO>
|
mondo.test.mjs - <short description TODO>
|
||||||
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/mini/test/mini.test.mjs>
|
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/mini/test/mini.test.mjs>
|
||||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { describe, expect, it } from 'vitest';
|
import { describe, expect, it } from 'vitest';
|
||||||
import { UzuParser, UzuRunner, printAst } from '../uzu.mjs';
|
import { MondoParser, MondoRunner, printAst } from '../mondo.mjs';
|
||||||
|
|
||||||
const parser = new UzuParser();
|
const parser = new MondoParser();
|
||||||
const p = (code) => parser.parse(code);
|
const p = (code) => parser.parse(code);
|
||||||
|
|
||||||
describe('uzu s-expressions parser', () => {
|
describe('mondo s-expressions parser', () => {
|
||||||
it('should parse an empty string', () => expect(p('')).toEqual({ type: 'list', children: [] }));
|
it('should parse an empty string', () => expect(p('')).toEqual({ type: 'list', children: [] }));
|
||||||
it('should parse a single item', () =>
|
it('should parse a single item', () =>
|
||||||
expect(p('a')).toEqual({ type: 'list', children: [{ type: 'plain', value: 'a' }] }));
|
expect(p('a')).toEqual({ type: 'list', children: [{ type: 'plain', value: 'a' }] }));
|
||||||
|
|
@ -56,7 +56,7 @@ let desguar = (a) => {
|
||||||
return printAst(parser.parse(a), true);
|
return printAst(parser.parse(a), true);
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('uzu sugar', () => {
|
describe('mondo sugar', () => {
|
||||||
it('should desugar []', () => expect(desguar('[a b c]')).toEqual('(seq a b c)'));
|
it('should desugar []', () => expect(desguar('[a b c]')).toEqual('(seq a b c)'));
|
||||||
it('should desugar [] nested', () => expect(desguar('[a [b c] d]')).toEqual('(seq a (seq b c) d)'));
|
it('should desugar [] nested', () => expect(desguar('[a [b c] d]')).toEqual('(seq a (seq b c) d)'));
|
||||||
it('should desugar <>', () => expect(desguar('<a b c>')).toEqual('(cat a b c)'));
|
it('should desugar <>', () => expect(desguar('<a b c>')).toEqual('(cat a b c)'));
|
||||||
|
|
@ -7,9 +7,9 @@ export default defineConfig({
|
||||||
plugins: [],
|
plugins: [],
|
||||||
build: {
|
build: {
|
||||||
lib: {
|
lib: {
|
||||||
entry: resolve(__dirname, 'uzu.mjs'),
|
entry: resolve(__dirname, 'mondo.mjs'),
|
||||||
formats: ['es'],
|
formats: ['es'],
|
||||||
fileName: (ext) => ({ es: 'uzu.mjs' })[ext],
|
fileName: (ext) => ({ es: 'mondo.mjs' })[ext],
|
||||||
},
|
},
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
// external: [...Object.keys(dependencies)],
|
// external: [...Object.keys(dependencies)],
|
||||||
18
pnpm-lock.yaml
generated
18
pnpm-lock.yaml
generated
|
|
@ -344,6 +344,15 @@ importers:
|
||||||
specifier: ^3.0.4
|
specifier: ^3.0.4
|
||||||
version: 3.0.4(@types/debug@4.1.12)(@types/node@22.10.10)(@vitest/ui@3.0.4)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0)
|
version: 3.0.4(@types/debug@4.1.12)(@types/node@22.10.10)(@vitest/ui@3.0.4)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0)
|
||||||
|
|
||||||
|
packages/mondo:
|
||||||
|
devDependencies:
|
||||||
|
vite:
|
||||||
|
specifier: ^6.0.11
|
||||||
|
version: 6.0.11(@types/node@22.10.10)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0)
|
||||||
|
vitest:
|
||||||
|
specifier: ^3.0.4
|
||||||
|
version: 3.0.4(@types/debug@4.1.12)(@types/node@22.10.10)(@vitest/ui@3.0.4)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0)
|
||||||
|
|
||||||
packages/motion:
|
packages/motion:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@strudel/core':
|
'@strudel/core':
|
||||||
|
|
@ -540,15 +549,6 @@ importers:
|
||||||
specifier: ^3.0.4
|
specifier: ^3.0.4
|
||||||
version: 3.0.4(@types/debug@4.1.12)(@types/node@22.10.10)(@vitest/ui@3.0.4)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0)
|
version: 3.0.4(@types/debug@4.1.12)(@types/node@22.10.10)(@vitest/ui@3.0.4)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0)
|
||||||
|
|
||||||
packages/uzu:
|
|
||||||
devDependencies:
|
|
||||||
vite:
|
|
||||||
specifier: ^6.0.11
|
|
||||||
version: 6.0.11(@types/node@22.10.10)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0)
|
|
||||||
vitest:
|
|
||||||
specifier: ^3.0.4
|
|
||||||
version: 3.0.4(@types/debug@4.1.12)(@types/node@22.10.10)(@vitest/ui@3.0.4)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0)
|
|
||||||
|
|
||||||
packages/web:
|
packages/web:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@strudel/core':
|
'@strudel/core':
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue