{"id":24993,"library":"benoit","title":"Benoît","description":"Benoît is a self-interpreting, self-evolving, self-proving programming language where every line is simultaneously code, test, proof, and documentation. Version 0.8.0 runs .ben files natively via a Pratt parser and tree-walking evaluator (zero eval, zero new Function), offers 68% token reduction compared to equivalent JavaScript, and includes a genetic algorithm (evolve.mjs) that discovers functions from assertions alone with 80% success rate. Active development with monthly releases, it targets Node >=18 and focuses on human-AI collaboration, pattern matching with guards, pipes, async/await, and a built-in property inference engine that detects 31 mathematical properties automatically. Unlike traditional languages, there is no separation between code, tests, and documentation.","status":"active","version":"0.8.0","language":"javascript","source_language":"en","source_url":"https://github.com/SanTiepi/benoit","tags":["javascript","language","transpiler","ai","ai-to-ai","protocol","function-algebra","synthesis","token-efficient"],"install":[{"cmd":"npm install benoit","lang":"bash","label":"npm"},{"cmd":"yarn add benoit","lang":"bash","label":"yarn"},{"cmd":"pnpm add benoit","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only since v0.4.0. Default export is the transpiler/interpreter function.","wrong":"const benoit = require('benoit')","symbol":"default","correct":"import benoit from 'benoit'"},{"note":"Function to run .ben strings or files. Exported as runBen (camelCase), not run_ben.","wrong":"import { run_ben } from 'benoit'","symbol":"runBen","correct":"import { runBen } from 'benoit'"},{"note":"Transpiles Benoît code to JavaScript. compile was removed in v0.5.0.","wrong":"import { compile } from 'benoit'","symbol":"transpile","correct":"import { transpile } from 'benoit'"},{"note":"Class for the self-programming machine. evolve is a CLI script (evolve.mjs), not a library export.","wrong":"import { evolve } from 'benoit'","symbol":"EvolveMachine","correct":"import { EvolveMachine } from 'benoit'"}],"quickstart":{"code":"import { runBen } from 'benoit';\n\nconst code = `\nfib n ->\n  n < 2? -> n\n  else? -> fib(n - 1) + fib(n - 2)\n\nfib(0) is 0\nfib(5) is 5\nfib(10) is 55\n`;\n\nrunBen(code).then(({ passed, total }) => {\n  console.log(`Passed ${passed}/${total} assertions.`);\n}).catch(err => console.error(err));","lang":"typescript","description":"Shows how to run Benoît code inline via runBen, verifying assertions directly from a string. The language ships with full TypeScript definitions."},"warnings":[{"fix":"Use import syntax instead of require(). Update Node to >=12 and set \"type\": \"module\" in package.json.","message":"v0.4.0 dropped CommonJS support; package is ESM-only.","severity":"breaking","affected_versions":">=0.4.0"},{"fix":"Replace compile with transpile in imports. compile is no longer exported.","message":"v0.5.0 renamed compile API to transpile.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"If using default import, adjust usage to new shape. Use named exports for specific operations.","message":"v0.6.0 changed default export from a parse function to a multi-purpose transformer.","severity":"breaking","affected_versions":">=0.6.0"},{"fix":"Replace evalBen with runBen. evalBen remains for backward compatibility but will be removed in next major.","message":"evalBen function deprecated since v0.7.0; use runBen instead.","severity":"deprecated","affected_versions":">=0.7.0"},{"fix":"Use 'when condition ->' inside alt patterns, not 'if condition ->'.","message":"Pattern-matching guards use 'when' keyword; 'if' is not valid inside patterns.","severity":"gotcha","affected_versions":">=0.3.0"},{"fix":"Do not assume Benoît code runs faster; it is a syntactic compaction tool.","message":"Token-reduction measurement is for transpiled JS, not for performance; no benchmarks guarantee speed improvement.","severity":"gotcha","affected_versions":">=0.3.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use dynamic import or switch to ESM: import benoit from 'benoit'.","cause":"Package is ESM-only since v0.4.0; using require() in a CJS context.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported"},{"fix":"Use import { transpile } from 'benoit' instead.","cause":"compile was renamed to transpile in v0.5.0.","error":"TypeError: benoit.compile is not a function"},{"fix":"Ensure guard '?' follows the pattern arrow correctly: pattern -> guard? -> expr.","cause":"Using '?' as a condition marker in a pattern without proper alt branch syntax.","error":"SyntaxError: Unexpected token (0:22) - '?' is not valid at this position"},{"fix":"Call runBen with a string or a path, not an options object.","cause":"runBen requires a string of code or a .ben file path.","error":"Error: runBen expects a string or a file path, got object"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}