Monorepo for Aesthetic.Computer
aesthetic.computer
1// Verify the bundled source parses correctly
2import { parse } from './kidlisp-mini/eval.mjs';
3
4const bundledSource = `fade:red-blue-black-blue-red
5(ink (? rainbow white 0) (1s... 24 64))
6(line w/2 0 w/2 h)
7(spin (2s... -1.125 1.125)) (zoom 1.1)
8(0.5s (contrast 1.05))
9(scroll (? -0.1 0 0.1) (? -0.1 0 0.1))
10(ink (? cyan yellow magenta) 8)
11(circle w/2 h/2 (? 2 4 8))`;
12
13const ast = parse(bundledSource);
14console.log('=== PARSED AST ===');
15console.log('AST length:', ast.length);
16console.log('Top-level expressions:');
17ast.forEach((expr, i) => {
18 if (Array.isArray(expr)) {
19 console.log(` [${i}]: (${expr[0]} ...)`);
20 } else if (typeof expr === 'object' && expr.type === 'fade') {
21 console.log(` [${i}]: fade:${expr.colors.join('-')}`);
22 } else {
23 console.log(` [${i}]: ${expr}`);
24 }
25});
26
27console.log('\n=== FUNCTION CALLS ===');
28ast.forEach((expr, i) => {
29 if (Array.isArray(expr) && typeof expr[0] === 'string') {
30 const fn = expr[0];
31 const args = expr.slice(1).length;
32 console.log(` ${fn}: ${args} args`);
33 }
34});