{"id":25640,"library":"gooberscript-compiler","title":"GooberScript Compiler","description":"A self-contained compiler, lexer, parser, and transpiler for the GooberScript language, a friendly syntax that compiles to clean ES2020 JavaScript. Version 1.2.0 targets browser and Node.js environments, distributed via npm and CDN (jsDelivr). Key differentiators: includes a complete toolchain in a single file (goobc.js), exposes a global `Goobc` object for browser script tags, enforces mandatory file structure and unique syntax rules like the `yippee;` check marker. Ideal for educational platforms like CodeHS, with no external dependencies.","status":"active","version":"1.2.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","gooberscript","compiler","transpiler","language","codehs","jsdelivr"],"install":[{"cmd":"npm install gooberscript-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add gooberscript-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add gooberscript-compiler","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"CommonJS require is not supported; any require attempt will result in a runtime error because the package only provides an ESM default export.","wrong":"const Goobc = require('gooberscript-compiler')","symbol":"Goobc","correct":"import Goobc from 'gooberscript-compiler'"},{"note":"`compile` is a method on the default export object, not a named export from the package.","wrong":"const { compile } = require('gooberscript-compiler');","symbol":"compile","correct":"const { compile } = Goobc;\nconst result = compile(source);"},{"note":"When loaded via script tag, a global `Goobc` object is exposed. Do not try to access `.default` – it does not exist.","wrong":"const result = Goobc.default.compile(source);","symbol":"Goobc (global)","correct":"<script src=\"https://cdn.jsdelivr.net/npm/gooberscript-compiler@1/goobc.js\"></script>\nconst result = Goobc.compile(source);"}],"quickstart":{"code":"// Load via CDN in HTML: <script src=\"https://cdn.jsdelivr.net/npm/gooberscript-compiler@1/goobc.js\"></script>\n\nconst gooberSource = `\ndear goober;\nheck name iskinda \"World\" ya;\ngoober greet() {\n  yippee;\n  holler(\"Hello, \" + name + \"!\") ya;\n} ya;\ngreet() ya;\nthanks, goober;\n`;\n\nconst result = Goobc.compile(gooberSource);\n\nif (result.errors && result.errors.length > 0) {\n  console.error('Compilation failed:', result.errors);\n} else {\n  console.log('Transpiled JS:', result.js);\n  new Function(result.js)();\n}","lang":"javascript","description":"Demonstrates loading the compiler via CDN, compiling a simple GooberScript program, and executing the transpiled JavaScript."},"warnings":[{"fix":"Ensure source begins with `dear goober;\\n` and ends with `\\nthanks, goober;` and each function contains `yippee;` once.","message":"GooberScript source must include the mandatory `dear goober;` header and `thanks, goober;` footer, plus a `yippee;` statement in every function body.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Append `ya;` after every statement, e.g., `holler(\"Hello\") ya;`","message":"All statements must end with `ya;` (equivalent to semicolon), including function calls, variable declarations, and control flow.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Only compile and run GooberScript from trusted sources; validate or sandbox if user-provided.","message":"The compiler runs client-side and can execute arbitrary JavaScript via `new Function()`. Ensure source is trusted to avoid XSS.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Access `result.errors` (array) instead of `result.error` (string).","message":"v1.2.0 changed the return shape of Goobc.compile(): errors are now in an array instead of an object property `error`.","severity":"breaking","affected_versions":">=1.2.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use CDN script tag: `<script src=\"https://cdn.jsdelivr.net/npm/gooberscript-compiler@1/goobc.js\"></script>` or in Node.js: `import Goobc from 'gooberscript-compiler'`","cause":"Package not loaded or imported incorrectly in Node.js (require not supported).","error":"Goobc is not defined"},{"fix":"Use `import Goobc from 'gooberscript-compiler'` then `Goobc.compile(source)`.","cause":"Attempted to use a named import `{ compile }` instead of default import.","error":"TypeError: Goobc.compile is not a function"},{"fix":"Start every GooberScript program with exactly `dear goober;` on its own line.","cause":"GooberScript source is missing the required file header.","error":"Missing mandatory header 'dear goober;'"},{"fix":"Add `yippee;` as the first statement inside each function body.","cause":"A function body lacks the required `yippee;` statement.","error":"Missing mandatory check 'yippee;'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}