AI News HubLIVE
站内改写3 min read

Show HN: Moss, an AI-led programming language experiment

Moss is an experimental programming language for long-lived software projects where humans and AI agents collaborate. Created by Codex and Fujo930, it is at version 0.2.0 with self-hosting sketches.

SourceHacker News AIAuthor: Fujo930

Notifications You must be signed in to change notification settings

Fork 0

Star 1

BranchesTags

Open more actions menu

Folders and files

NameName

Last commit message

Last commit date

Latest commit

History

48 Commits

48 Commits

docs

docs

examples

examples

src/mosslang

src/mosslang

tests

tests

.gitattributes

.gitattributes

.gitignore

.gitignore

LICENSE

LICENSE

README.md

README.md

pyproject.toml

pyproject.toml

Repository files navigation

Moss is an experimental programming language for long-lived software projects where humans and AI agents work on the same codebase over time.

This repository is intentionally AI-built: Moss was designed, implemented, debugged, documented, committed, and pushed by Codex in collaboration with Fujo930. The project is public as a record of that process and as a runnable language prototype.

Version 0.2.0 is a self-hosting preview. Moss is not fully self-hosted yet, but Moss-written lexer, parser, checker, and project-check sketches already run against Moss source.

Quick start

From this folder:

python -m pip install -e . moss check examples/order.moss moss run examples/order.moss moss test examples/order.moss moss selfhost moss selfhost --quick moss studio

You can also run without installing:

python -m mosslang.cli run examples/order.moss

To build local release artifacts:

python -m pip install build python -m build

The package exposes a console command named moss.

What works now

effect declarations

type declarations for records and simple unions

rule declarations as pure expression functions

fn declarations with optional uses EffectName

test "name" { ... } blocks for language-level executable checks

records, record field access, and record updates

if, else if, and else blocks

list literals, indexing, for loops, len, listPush, listGet, listSet, listSlice, listConcat, listInsert, listRemove, and range

Map through mapNew, mapPut, mapGet, mapHas, mapKeys, mapValues, and mapRemove

while, break, and continue

Text helpers: textChars, textJoin, textSplit, textTrim, textSlice, textContains, textIndexOf, textReplace, textStartsWith, and textEndsWith

FileSystem effect builtins: readText, writeText, fileExists, and listFiles

top-level import "path.moss" declarations

self-hosting sketches with structured token records, reusable lexer/parser cores, a top-level declaration parser, and a first checker sketch: examples/self_host/tokenizer_sketch.moss and examples/self_host/parser_sketch.moss and examples/self_host/checker_sketch.moss

moss selfhost, which runs the tokenizer/parser/checker sketches plus examples/self_host/project_check.moss; the project check parses and checks the self-hosting Moss files with Moss code

nullary and payload variants such as Paid and ShipError.NotReady(Pending)

match expressions with wildcard and payload binding patterns

Result values with Ok(...), Err(...), and ?

require condition else value, which returns Err(value) from Result functions

runtime type contracts for function arguments and return values

List, Map, and Option runtime type contracts

a tiny in-memory database through dbPut and dbGet, guarded by the Database effect inside functions

Example

effect Database

type Order = id: Text status: Pending | Paid | Shipped | Cancelled total: Money

type ShipError = NotReady | Missing

rule canShip(order: Order) -> Bool = order.status == Paid and order.total > 0.usd

fn ship(order: Order) -> Result uses Database { require canShip(order) else ShipError.NotReady(order.status)

updated = order with status = Shipped dbPut(order.id, updated)

return Ok(updated) }

let order = { id: "A-100", status: Paid, total: 42.usd } let shipped = ship(order)? print("status:", shipped.status) print("stored:", dbGet("A-100").status)

Commands

moss check moss run moss test moss tokens moss ast moss selfhost moss selfhost --quick moss studio

moss studio opens a local HTTP editor at http://127.0.0.1:8765.

moss selfhost --quick runs the fast self-hosting sketches. moss selfhost also runs the slower Moss-written project check over examples/self_host.

Project status

This is version 0.2.0: a compact interpreter with real syntax, runtime semantics, a browser editor, and Moss-written self-hosting sketches. The repository is released under the MIT License.

Suitable claims:

Moss is AI-designed and AI-built.

Moss can run useful example programs today.

Moss has begun self-hosting.

Moss is still alpha software and should not be described as fully self-hosted.

The next useful steps are a structured Moss AST, richer diagnostics, a formatter, and comparing Moss-written frontend output against the Python host frontend.

GitHub's language bar is powered by Linguist. .moss files are marked detectable in .gitattributes, but GitHub will only show Moss as a first-class language after Moss is accepted into the upstream Linguist language list.

See docs/language.md for the current language surface, docs/studio.md for the browser editor, docs/history.md for a commit-by-commit feature guide, and docs/roadmap.md for the path from prototype to a serious implementation. See docs/release.md for the public 0.2.0 release notes and packaging checklist.

About

A runnable prototype of the Moss programming language and browser studio.

Resources

Readme

License

MIT license

Uh oh!

There was an error while loading. Please reload this page.

Activity

Stars

1 star

Watchers

0 watching

Forks

0 forks

Report repository

Releases

No releases published

Packages 0

Uh oh!

There was an error while loading. Please reload this page.

Contributors

Uh oh!

There was an error while loading. Please reload this page.

Languages

Python 84.4%

JavaScript 9.1%

CSS 4.2%

HTML 2.3%