{"id":25762,"library":"iota-compiler","title":"iota-compiler","description":"Io-to-JavaScript source-to-source compiler, version 0.2.3. Originally written for CodeCombat's parser challenge, now used in CodeCombat via Aether. Compiles a minimal subset of Io (messages, objects, methods, prototype chain, infix operators) into JavaScript. Dependencies include Escodegen for code generation and Jison for parsing. The project is in early development; many core constructs and standard library features are missing. Differentiators: direct JavaScript interop, AST conforms to Mozilla Parser API, CLI and library usage.","status":"active","version":"0.2.3","language":"javascript","source_language":"en","source_url":"git://github.com/dariusf/iota","tags":["javascript","io","js","parser","codecombat","compiler"],"install":[{"cmd":"npm install iota-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add iota-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add iota-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"JavaScript code generation from AST","package":"escodegen","optional":false}],"imports":[{"note":"ESM import works with bundlers; CJS require also supported but ESM preferred.","wrong":"const iota = require('iota-compiler')","symbol":"default","correct":"import iota from 'iota-compiler'"},{"note":"Named export for parsing Io code to AST.","symbol":"parse","correct":"import { parse } from 'iota-compiler'"},{"note":"Named export for compiling Io code to JavaScript string.","symbol":"compile","correct":"import { compile } from 'iota-compiler'"},{"note":"Named export, but avoid shadowing global eval; use iota.eval() or alias.","wrong":"import ev from 'iota-compiler' then ev.eval()","symbol":"eval","correct":"import { eval } from 'iota-compiler'"}],"quickstart":{"code":"import iota from 'iota-compiler';\n\nconst ioCode = `\n  greet := method(name,\n    \"Hello, \" .. name\n  )\n  greet(\"World\")\n`;\n\n// Evaluate with convenience method\nconst result = iota.eval(ioCode);\nconsole.log(result); // Output: \"Hello, World\"\n\n// Or compile and run manually\nconst compiled = iota.compile(ioCode);\neval(compiled);\n","lang":"typescript","description":"Shows basic usage of iota eval and compile with Io code to compute a greeting."},"warnings":[{"fix":"Check the 'Still to come' list in README; avoid using unsupported features.","message":"Only a minimal subset of Io is implemented; many standard library methods and constructs are missing.","severity":"gotcha","affected_versions":"*"},{"fix":"Always include `var _io = iota.lib;` before calling `eval(iota.compile(code))`.","message":"The runtime library binding `_io` is required for manual eval; default export's `lib` property must be available.","severity":"gotcha","affected_versions":"*"},{"fix":"Set `wrapWithFunction: true` to run within a function context, preventing global leaks.","message":"Options like `wrapWithFunction` and `useProxy` change the output format; default is standalone code that may pollute global scope.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Add `const _io = require('iota-compiler').lib;` before `eval(iota.compile(code))`.","cause":"Missing runtime library when manually evaluating compiled JavaScript.","error":"ReferenceError: _io is not defined"},{"fix":"Use default import: `import iota from 'iota-compiler'` or `const iota = require('iota-compiler')`.","cause":"Using older import style (e.g., `import * as iota from 'iota-compiler'`)","error":"TypeError: iota.eval is not a function"},{"fix":"Review supported features; avoid using 'self' or unsupported operators.","cause":"Io code contains unsupported constructs like 'self' or first-class primitive methods.","error":"SyntaxError: Unexpected token"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}