{"id":14706,"library":"milkdrop-eel-parser","title":"Milkdrop EEL2 Parser","description":"The `milkdrop-eel-parser` library provides a parser for the Nullsoft/Cockos EEL2 (Expression Evaluation Library 2) scripting language, primarily used in the Milkdrop music visualizer. It is designed to convert EEL2 equations into JavaScript, enabling their use in modern web-based visualizers like Butterchurn. Currently at version `0.0.4`, this project is predominantly written in ClojureScript and compiles to a JavaScript bundle. Its development appears to be in maintenance mode, with no significant updates in the last 7-8 years. Key differentiators include its niche focus on EEL2 parsing and its integration into the broader Butterchurn ecosystem, allowing developers to bring legacy Milkdrop preset logic to the browser environment.","status":"maintenance","version":"0.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/jberg/milkdrop-eel-parser","tags":["javascript"],"install":[{"cmd":"npm install milkdrop-eel-parser","lang":"bash","label":"npm"},{"cmd":"yarn add milkdrop-eel-parser","lang":"bash","label":"yarn"},{"cmd":"pnpm add milkdrop-eel-parser","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This library is a ClojureScript compilation output, exposing a global `MilkdropEELParser` object. It is not designed for modern ES module `import` syntax. Direct script inclusion is the intended method for browser environments.","symbol":"MilkdropEELParser","correct":"<!-- In HTML -->\n<script src=\"https://unpkg.com/milkdrop-eel-parser/release/md-parser.min.js\"></script>\n<script>\n  const parser = window.MilkdropEELParser;\n  // ... use parser.parseExpression or parser.convertExpression\n</script>"},{"note":"Access `parseExpression` as a method on the global `MilkdropEELParser` object after the script has loaded. It handles parsing the EEL2 syntax into an intermediate representation.","wrong":"import { parseExpression } from 'milkdrop-eel-parser';","symbol":"parseExpression","correct":"const parsed = window.MilkdropEELParser.parseExpression('x + y');"},{"note":"Access `convertExpression` as a method on the global `MilkdropEELParser` object. This function takes an EEL2 expression and translates it into an equivalent JavaScript string for execution.","wrong":"const convertExpression = require('milkdrop-eel-parser').convertExpression;","symbol":"convertExpression","correct":"const converted = window.MilkdropEELParser.convertExpression('x + y');"}],"quickstart":{"code":"<!-- index.html -->\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <title>Milkdrop EEL Parser Quickstart</title>\n</head>\n<body>\n  <h1>Milkdrop EEL2 Parser Example</h1>\n  <p>Original EEL2 Expression: <code>'x = x + 0.1;'</code></p>\n  <p>Parsed Output (console): <code id=\"parsedOutput\"></code></p>\n  <p>Converted JavaScript (console): <code id=\"convertedOutput\"></code></p>\n\n  <!-- Load the library via CDN -->\n  <script src=\"https://unpkg.com/milkdrop-eel-parser/release/md-parser.min.js\"></script>\n\n  <script>\n    if (window.MilkdropEELParser) {\n      const eelExpression = 'x = x + 0.1;';\n\n      // Parse the EEL2 expression\n      const parsedAst = window.MilkdropEELParser.parseExpression(eelExpression);\n      document.getElementById('parsedOutput').textContent = 'Check console for AST';\n      console.log('Parsed AST:', parsedAst);\n\n      // Convert the EEL2 expression to JavaScript\n      const jsFunctionString = window.MilkdropEELParser.convertExpression(eelExpression);\n      document.getElementById('convertedOutput').textContent = jsFunctionString;\n      console.log('Converted JavaScript function string:', jsFunctionString);\n\n      // Example of executing the converted JS (for demonstration, be careful with eval in prod)\n      // Note: `x` would typically be part of a larger state object in a real visualizer\n      let x = 0;\n      const fn = new Function('x', 'return (' + jsFunctionString + ');');\n      console.log('Initial x:', x);\n      for (let i = 0; i < 5; i++) {\n        x = fn(x);\n        console.log(`x after iteration ${i + 1}:`, x);\n      }\n\n    } else {\n      console.error('MilkdropEELParser not found. Is the script loaded correctly?');\n    }\n  </script>\n</body>\n</html>","lang":"javascript","description":"This quickstart demonstrates how to include the `milkdrop-eel-parser` in an HTML page via a `<script>` tag and use its global `MilkdropEELParser` object to parse and convert EEL2 expressions into executable JavaScript."},"warnings":[{"fix":"Use a `<script>` tag to load `md-parser.min.js` (e.g., from unpkg) and access `window.MilkdropEELParser`.","message":"This library is a ClojureScript compilation output and does not offer standard ES module (`import`) or CommonJS (`require`) exports. It exposes a global `window.MilkdropEELParser` object, requiring direct script inclusion in HTML.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Always pin to an exact version (e.g., `0.0.4`) if using this library in a build process, and thoroughly test upgrades.","message":"The package version `0.0.4` indicates a very early development stage. While no formal breaking changes are documented, minor versions in this range often introduce API changes without adherence to strict semantic versioning.","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"Consider forking the repository if active development or long-term maintenance is required for your project.","message":"The project repository shows no significant commits in the last 7-8 years, implying it is largely unmaintained. Users should be aware that bug fixes, feature requests, or compatibility updates are unlikely.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Only convert and execute EEL2 expressions from trusted sources. Implement robust input validation and sanitization for any user-provided EEL2 code.","message":"The `convertExpression` function generates a JavaScript string. Executing this string directly (e.g., with `eval` or `new Function()`) can pose security risks if the EEL2 input is untrusted or malformed. Ensure all EEL2 expressions are sanitized.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure the `<script src=\"https://unpkg.com/milkdrop-eel-parser/release/md-parser.min.js\"></script>` tag is included in your HTML before any code attempts to access `window.MilkdropEELParser`.","cause":"The `milkdrop-eel-parser` library was not loaded via a script tag, or the script tag was placed incorrectly (e.g., after attempting to use the object).","error":"ReferenceError: MilkdropEELParser is not defined"},{"fix":"Always pass a valid EEL2 expression as a string to the parsing and conversion functions, e.g., `window.MilkdropEELParser.parseExpression('vol = 0.5;')`.","cause":"The `parseExpression` or `convertExpression` function was called without a string argument, or with a non-string argument.","error":"Error: Must pass an expression string to parseExpression."}],"ecosystem":"npm"}