Tech

Developer releases Forth-inspired language for web development

A software engineer and former climate scientist has introduced 'forge', a tool that compiles stack-based code into HTML, supporting both server-side rendering for crawlers and client-side single-page application experiences.

Author
Owen Mercer
Markets and Finance Editor
Published
Draft
Source: Hacker News · original
Tech
No image available
Stack-based compiler targets single-page applications and structured data

A software engineer and former climate scientist has developed a stack-based, Forth-inspired programming language named "forge" for creating websites. The system utilises a binary compiler that converts .forge files into HTML, offering a distinct approach to web development that prioritises structural simplicity and explicit state management.

The architecture supports dual rendering modes to balance performance with accessibility. Server-side rendering ensures content is indexable by search engine crawlers and compatible with WebMentions, while client-side rendering via service workers facilitates a single-page application (SPA) experience. When a user navigates between pages, the service worker captures the request, fetches the source file, and builds the HTML on the fly within the browser.

State persistence is a core feature of the language, allowing developers to store data in localStorage or utilise server-side append-only JSONL logs. This capability enables interactive elements such as "like" buttons and form submissions. For instance, a user interaction can append a value to a specific topic in a JSONL log, with the target page responsible for processing the stored data via log-append functions.

The language also includes a library of word definitions designed to simplify the integration of microformats into HTML. Each site is structured as a collection of pages, a library of definitions, and a stylesheet, with the compiler exposing both the generated HTML source and the original .forge source code upon page visit.

The creator, who identifies as a musician and webmaster, describes the project as an exploration of ideas rather than a finished product. While the tool is currently highlighted on Hacker News, the developer notes they are still evaluating its viability and may eventually adopt it for their own site.

Continue reading

More from Tech

Read next: Apple opens developer access to iOS, iPadOS and macOS 27 betas
Read next: Apple confirms macOS 27 Golden Gate requires Apple Silicon, ending Intel support
Read next: Apple unveils watchOS 27 with Siri AI integration and hardware restrictions