mirror of
https://codeberg.org/uzu/strudel
synced 2026-07-13 14:26:58 -04:00
rename uzu to mondo
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
```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')
|
||||
```
|
||||
|
||||
@@ -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>
|
||||
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
|
||||
export class UzuParser {
|
||||
export class MondoParser {
|
||||
// these are the tokens we expect
|
||||
token_types = {
|
||||
string: /^"(.*?)"/,
|
||||
@@ -251,9 +251,9 @@ export function printAst(ast, compact = false, lvl = 0) {
|
||||
}
|
||||
|
||||
// lisp runner
|
||||
export class UzuRunner {
|
||||
export class MondoRunner {
|
||||
constructor(lib) {
|
||||
this.parser = new UzuParser();
|
||||
this.parser = new MondoParser();
|
||||
this.lib = lib;
|
||||
}
|
||||
// a helper to check conditions and throw if they are not met
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "uzu",
|
||||
"name": "mondo",
|
||||
"version": "1.1.0",
|
||||
"description": "an uzu notation",
|
||||
"main": "uzu.mjs",
|
||||
"description": "a language for functional composition that translates to js",
|
||||
"main": "mondo.mjs",
|
||||
"type": "module",
|
||||
"publishConfig": {
|
||||
"main": "dist/uzu.mjs"
|
||||
"main": "dist/mondo.mjs"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
@@ -29,7 +29,7 @@
|
||||
"bugs": {
|
||||
"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": {
|
||||
"vite": "^6.0.11",
|
||||
"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>
|
||||
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 { 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);
|
||||
|
||||
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 a single item', () =>
|
||||
expect(p('a')).toEqual({ type: 'list', children: [{ type: 'plain', value: 'a' }] }));
|
||||
@@ -56,7 +56,7 @@ let desguar = (a) => {
|
||||
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 [] 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)'));
|
||||
@@ -7,9 +7,9 @@ export default defineConfig({
|
||||
plugins: [],
|
||||
build: {
|
||||
lib: {
|
||||
entry: resolve(__dirname, 'uzu.mjs'),
|
||||
entry: resolve(__dirname, 'mondo.mjs'),
|
||||
formats: ['es'],
|
||||
fileName: (ext) => ({ es: 'uzu.mjs' })[ext],
|
||||
fileName: (ext) => ({ es: 'mondo.mjs' })[ext],
|
||||
},
|
||||
rollupOptions: {
|
||||
// external: [...Object.keys(dependencies)],
|
||||
Generated
+9
-9
@@ -344,6 +344,15 @@ importers:
|
||||
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/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:
|
||||
dependencies:
|
||||
'@strudel/core':
|
||||
@@ -540,15 +549,6 @@ importers:
|
||||
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/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:
|
||||
dependencies:
|
||||
'@strudel/core':
|
||||
|
||||
Reference in New Issue
Block a user