@nathan123!/gooberscript-compiler
v1.0.0
Published
The GooberScript toolchain (Compiler, Lexer, Parser, Transpiler) for ES2020 JavaScript.
Downloads
15
Maintainers
Readme
🥳 GooberScript Toolchain
GooberScript is an enthusiastic new language that transpiles directly to clean ES2020 JavaScript. This repository contains the complete, self-contained compiler (goobc.js).
Quick Start (CDN Integration)
For immediate use in environments like CodeHS, load the compiler directly via jsDelivr. Since goobc.js is self-contained and exposes the global Goobc object, you are ready to compile immediately.
- Include the Compiler:
- Use the Compiler API:
// Example GooberScript Code const gooberSource = ` dear goober; heck name isexactly "World" ya;
goober greet() { yippee; holler("Hello, " + name + "!"); ya; } ya;
greet(); ya;
thanks, goober; `;
// Compile and Execute const { js, errors } = Goobc.compile(gooberSource);
if (errors && errors.length > 0) { console.error("GooberScript Compilation Failed:", errors); } else { // Execution (Run the resulting JavaScript) console.log("--- Transpiled JS ---"); console.log(js); console.log("--- Execution Output ---"); try { new Function(js)(); } catch (e) { console.error("Runtime Error:", e); } }
🛠️ Deployment Instructions (Mac/Terminal)
Follow these steps to deploy your own version of the GooberScript toolchain to NPM and make it available on jsDelivr.
Step 1: Initialize Project
In your macOS Terminal:
Create and enter the project directory
mkdir gooberscript-repo cd gooberscript-repo
Initialize NPM
npm init -y
Step 2: Create Files
Save the content of goobc.js and package.json into the root of the gooberscript-repo directory.
Step 3: Publish to NPM
Before publishing, ensure you are logged into NPM (npm login).
This publishes your package and makes it available globally
npm publish --access public
Step 4: CDN Availability
Once published, your package is immediately mirrored by jsDelivr. The URL for CodeHS/web usage will be:
https://cdn.jsdelivr.net/npm/@nathan123!/gooberscript-compiler@/goobc.js
(Replace with your published version, e.g., 1.0.0).
GooberScript Language Reference
GooberScript Token
JS Equivalent
Rule / Notes
dear goober; / thanks, goober;
// Start / // End
MANDATORY File Delimiters.
ya;
;
MANDATORY Statement Terminator.
yippee;
// Check Pass
MANDATORY once per function body (GBR004).
goober
var
Function-scoped variable.
heck
let
Block-scoped variable.
nochange
const
Block-scoped constant (must be initialized).
whatif
if
Conditional flow.
otherwise whatif
else if
Chained conditional.
otherwise
else
Else block.
loopity
while
While loop.
gimme
return
Returns a value.
heckyeah
break
Exits loop.
nah
continue
Skips current loop iteration.
holler
console.log
Standard output.
nada
null
Null value.
andwhat
&&
Logical AND.
orelse
`
nuhuh!
!
Logical NOT.
isexactly
===
Strict equality.
iskinda
==
Loose equality.
aint
!==
Strict inequality.
x goUp ya;
x++;
Increment.
x goDown ya;
x--;
Decrement.
//goob / /*goob
// / /* */
Goober comments only.
