Registry / web-framework / gooberscript-compiler

gooberscript-compiler

JSON →
library1.2.0jsnpmunverified

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.

npm install gooberscript-compiler
INSTALL
IMPORT
SIG · GOOBERSCRIPT-COMPI
G
gooberscript-compiler
web-frameworkjavascriptv1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Goobc
✓ import Goobc from 'gooberscript-compiler'
✗ const Goobc = require('gooberscript-compiler')
CommonJS require is not supported; any require attempt will result in a runtime error because the package only provides an ESM default export.
compile
✓ const { compile } = Goobc; const result = compile(source);
✗ const { compile } = require('gooberscript-compiler');
`compile` is a method on the default export object, not a named export from the package.
Goobc (global)
✓ <script src="https://cdn.jsdelivr.net/npm/gooberscript-compiler@1/goobc.js"></script> const result = Goobc.compile(source);
✗ const result = Goobc.default.compile(source);
When loaded via script tag, a global `Goobc` object is exposed. Do not try to access `.default` – it does not exist.

Demonstrates loading the compiler via CDN, compiling a simple GooberScript program, and executing the transpiled JavaScript.

// Load via CDN in HTML: <script src="https://cdn.jsdelivr.net/npm/gooberscript-compiler@1/goobc.js"></script> const gooberSource = ` dear goober; heck name iskinda "World" ya; goober greet() { yippee; holler("Hello, " + name + "!") ya; } ya; greet() ya; thanks, goober; `; const result = Goobc.compile(gooberSource); if (result.errors && result.errors.length > 0) { console.error('Compilation failed:', result.errors); } else { console.log('Transpiled JS:', result.js); new Function(result.js)(); }
goobc --version
Debug
Known issues
gotchaGooberScript source must include the mandatory `dear goober;` header and `thanks, goober;` footer, plus a `yippee;` statement in every function body.
fix
Ensure source begins with `dear goober;\n` and ends with `\nthanks, goober;` and each function contains `yippee;` once.
affects: >=1.0.0
gotchaAll statements must end with `ya;` (equivalent to semicolon), including function calls, variable declarations, and control flow.
fix
Append `ya;` after every statement, e.g., `holler("Hello") ya;`
affects: >=1.0.0
gotchaThe compiler runs client-side and can execute arbitrary JavaScript via `new Function()`. Ensure source is trusted to avoid XSS.
fix
Only compile and run GooberScript from trusted sources; validate or sandbox if user-provided.
affects: >=1.0.0
breakingv1.2.0 changed the return shape of Goobc.compile(): errors are now in an array instead of an object property `error`.
fix
Access `result.errors` (array) instead of `result.error` (string).
affects: >=1.2.0
Errors
Common errors & fixes
Goobc is not defined
Package not loaded or imported incorrectly in Node.js (require not supported).
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'`
TypeError: Goobc.compile is not a function
Attempted to use a named import `{ compile }` instead of default import.
fix
Use `import Goobc from 'gooberscript-compiler'` then `Goobc.compile(source)`.
Missing mandatory header 'dear goober;'
GooberScript source is missing the required file header.
fix
Start every GooberScript program with exactly `dear goober;` on its own line.
Missing mandatory check 'yippee;'
A function body lacks the required `yippee;` statement.
fix
Add `yippee;` as the first statement inside each function body.
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
gooberscript-compiler — npm install gooberscript-compiler · libregistry