DEV Community

xvdvlinux-coder
xvdvlinux-coder

Posted on

I built a lightweight language to fix what frustrates me about JavaScript

Every time I start a small frontend project or write plain scripts, I find myself stuck between two frustrating extremes:

  1. Vanilla JavaScript still carries decades of quirks: confusing equality rules (== vs ===), multiple variable declarations, and verbose DOM APIs like document.querySelector and addEventListener repeated everywhere.
  2. TypeScript adds solid compile-time typing, but it brings heavy tooling friction: tsconfig.json configurations, bundler setups, build plugins, and massive node_modules before you write a single line. And at runtime, you are still writing the exact same verbose DOM boilerplate.

I wanted something clean in between. So I built Oriented-Direct (.osp), a language that compiles to standard JavaScript with zero external dependencies.


What does it look like?

The syntax removes ambiguity and cuts down browser boilerplate:

val submitBtn = @find("#submit");
val statusText = @id("status");

@on(submitBtn, "click", async (e) => {
    @css(submitBtn, { opacity: "0.6" });
    @text(statusText, "Processing...");

    val res = await fetch("/api/data");
    @log("Done:", res);
});
Enter fullscreen mode Exit fullscreen mode

Key differences from standard JS:

  • No variable confusion: Only val (immutable) and mut (mutable).
  • Strict equality: == and != always transpile to === and !==. No loose equality traps.
  • Built-in DOM directives: @find, @on, @css, @html, @text, and @emit directly in the grammar.
  • Zero-config toolchain: It comes with its own bundler, dev server with live reload, and Base64-VLQ source map generator in ~5K lines of pure JavaScript.

Because the syntax is so concise, it also cuts down token usage by ~33% when feeding code to AI agents and LLMs.


Try it out

You can run the dev server instantly with zero install:

npx @xvdxlinux/oriented-direct dev
Enter fullscreen mode Exit fullscreen mode

Or install it globally:

npm install -g @xvdxlinux/oriented-direct
ospc dev
Enter fullscreen mode Exit fullscreen mode

Would love to hear your feedback on the syntax design and approach!



Enter fullscreen mode Exit fullscreen mode

Top comments (0)