{"id":50249517,"url":"https://github.com/egorkhaklin/glass","last_synced_at":"2026-06-10T07:01:12.152Z","repository":{"id":359302026,"uuid":"1245421976","full_name":"EgorKhaklin/Glass","owner":"EgorKhaklin","description":"A pure functional language whose compiler is written in Glass and self-compiles to byte-identical C, carrying a from-scratch zero-knowledge STARK prover: write a function, get a proof of its result. Hindley-Milner types, effects, exhaustive matching.","archived":false,"fork":false,"pushed_at":"2026-05-31T22:15:47.000Z","size":3118,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-01T00:02:19.939Z","etag":null,"topics":["algebraic-data-types","compiler","cryptography","effect-system","fri","functional-programming","hindley-milner","interpreter","pattern-matching","programming-language","programming-language-design","refinement-types","self-hosting","stark","type-inference","type-system","zero-knowledge","zero-knowledge-proofs","zk","zk-stark"],"latest_commit_sha":null,"homepage":"https://github.com/EgorKhaklin/Glass/blob/main/docs/the-story.md","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EgorKhaklin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"docs/roadmap.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"EgorKhaklin"}},"created_at":"2026-05-21T07:52:33.000Z","updated_at":"2026-05-31T22:15:50.000Z","dependencies_parsed_at":"2026-06-04T01:00:33.473Z","dependency_job_id":null,"html_url":"https://github.com/EgorKhaklin/Glass","commit_stats":null,"previous_names":["egorkhaklin/glass"],"tags_count":134,"template":false,"template_full_name":null,"purl":"pkg:github/EgorKhaklin/Glass","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EgorKhaklin%2FGlass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EgorKhaklin%2FGlass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EgorKhaklin%2FGlass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EgorKhaklin%2FGlass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EgorKhaklin","download_url":"https://codeload.github.com/EgorKhaklin/Glass/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EgorKhaklin%2FGlass/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33886153,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-03T02:00:06.370Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algebraic-data-types","compiler","cryptography","effect-system","fri","functional-programming","hindley-milner","interpreter","pattern-matching","programming-language","programming-language-design","refinement-types","self-hosting","stark","type-inference","type-system","zero-knowledge","zero-knowledge-proofs","zk","zk-stark"],"created_at":"2026-05-27T01:05:24.201Z","updated_at":"2026-06-10T07:01:12.140Z","avatar_url":"https://github.com/EgorKhaklin.png","language":"Python","funding_links":["https://github.com/sponsors/EgorKhaklin"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"assets/glass-logo.jpg\" alt=\"Glass\" width=\"460\"/\u003e\n\n\n### You can see straight through it.\n\n[![Tests](https://github.com/EgorKhaklin/Glass/actions/workflows/tests.yml/badge.svg)](https://github.com/EgorKhaklin/Glass/actions/workflows/tests.yml)\n[![Tests passing](https://img.shields.io/badge/tests-476%2F476-00bcd4?style=flat-square)](tests/test_glass.py)\n[![Self-hosting](https://img.shields.io/badge/self--hosting-✓_bootstrap_fixpoint-00bcd4?style=flat-square)](docs/self-hosting.md)\n[![Verified twice](https://img.shields.io/badge/proofs-checked_by_two_verifiers-00bcd4?style=flat-square)](pentecost/)\n[![License](https://img.shields.io/badge/license-MIT_OR_Apache--2.0-00bcd4?style=flat-square)](LICENSE)\n\n\u003c/div\u003e\n\n\u003cbr/\u003e\n\nNow a machine writes the code.\n\nYou describe what you want; it generates the structure. It runs, it reads\ncleanly, it passes the demo and you are asked to trust it. The hard part was\nnever the typing. It was the trust. Underneath the plausible surface: a side\neffect nobody declared, a branch never handled, a function that does more than\nits name admits. And the plausible now ships faster than anyone can read it.\n\nGlass refuses the asking.\n\nLet the structure be generated — by you, by a model, by anyone. Glass does not\nask where it came from. It asks only that the truth about it stay visible, and\nvisible means machine-checkable, not merely plausible.\n\n\u003e Looks right is not the same as is right. One can be generated. The other has\n\u003e to be reconstructed.\n\nSo nothing is left implicit. Every signature states what a function takes,\nreturns, touches, and how it fails — declared, not discovered at runtime. A\nfunction can't touch, return, or fail in any way its signature doesn't admit.\nEffects are declared or they don't compile. Matches are exhaustive. Failure is a\nvalue the caller must face, never a silent surprise. None of this is taken on\nfaith; it's checked, by the compiler, on every program, today.\n\nYou don't audit the intention. You audit what's *there* — and what's there has\nnowhere left to hide.\n\nGenerated or written, one rule does not bend: you should never have to take the\ncode's word for it.\n\nIt tells the truth. It reconstructs itself. It proves what happened — and lets\nthe proof be checked by something other than itself. The first you have just\nread; the rest it shows you below.\n\n\u003cbr/\u003e\n\n\u003e ### It reconstructs itself.\n\u003e Glass's compiler is **written in Glass**, and rebuilds itself byte-for-byte —\n\u003e two independently-produced native compilers emit identical C, with no other\n\u003e language left in the loop. And the discipline runs deeper than that:\n\u003e every layer is computed *two independent ways* — a reference meaning and a\n\u003e compiled one — and forced to agree to the last bit. The instant the two\n\u003e reconstructions diverge, it's a desync, and the build stops. A system you can\n\u003e replay and check against itself, where no divergence slips past unnoticed.\n\u003e\n\u003e ### It proves what happened.\n\u003e Built from scratch, in Glass: a **zero-knowledge prover**. Commit a private\n\u003e dataset, ask it a question — *the total payroll, the headcount, and from a\n\u003e proven sum and count, the average* — and get back a cryptographic proof of the\n\u003e answer that reveals the commitment, the query, the result, and **not a single\n\u003e row**.\n\u003e\n\u003e Then it closes the loop: **write a Glass function — arithmetic, comparisons,\n\u003e calls, recursion — and get a zero-knowledge proof of its result**, over the\n\u003e production **Goldilocks** field that real provers use (the default for `glass\n\u003e prove`; a toy Baby Bear field adds full `match`-over-your-own-types for\n\u003e teaching). The prover is a from-scratch STARK — field, Poseidon hash, Merkle\n\u003e trees, FRI, blinding. You write what a program *means*; you get a\n\u003e machine-checkable proof it ran exactly as written.\n\u003e\n\u003e ### And it's checked twice.\n\u003e A proof you can't independently check is just a promise. So the verifier is\n\u003e **two**: a second, from-scratch re-implementation — a different language, a\n\u003e different number representation, sharing **no code** with the prover —\n\u003e re-derives every challenge and re-checks the proof. Emit it on one side\n\u003e (`glass prove --emit`), verify it on the other (`glass verify`) — separate\n\u003e programs, separate lineages, one verdict that must agree. And when the prover\n\u003e can't faithfully turn a program into a circuit, it says so (**ABSTAIN**) rather\n\u003e than bluff an answer. A thousand-plus tampered and forged proofs have been\n\u003e thrown at the second verifier; every one was rejected.\n\u003e\n\u003e It is a from-scratch demonstration, not audited cryptography — what a proof here\n\u003e does and does not guarantee is written down in full in\n\u003e [the soundness ledger](docs/soundness.md).\n\n\u003cbr/\u003e\n\nRun it once, then run it again through the other implementation: reference and\ncompiled must meet at every bit. Ask it what a function computed, and it answers\nwith a proof — the result, and nothing it was built from. One principle runs the\nwhole distance, from a type signature to a zero-knowledge proof. It was the rule\nfrom the first line:\n**you should never have to take the code's word for it.**\n\n→ **[Read the whole story, end to end](docs/the-story.md)** — every claim a command you can run.\n\n\u003cbr/\u003e\n\n```glass\n# The signature is the entire contract: this returns EITHER an answer OR an\n# error, and the type system makes the caller handle both. No silent failure,\n# no exception, no surprise — the function can't do anything the type doesn't say.\n\nfn safe_divide(a: Int, b: Int) : Result\u003cInt, String\u003e =\n  if b == 0 then Err(\"cannot divide by zero\")\n  else Ok(a / b)\n\nmatch safe_divide(42, 6) {\n  Ok(n)  =\u003e print(\"result: \" ++ int_to_string(n));\n  Err(e) =\u003e print(\"error: \" ++ e)\n}\n```\n\n\u003cbr/\u003e\n\n## Try it\n\n```bash\ngit clone https://github.com/EgorKhaklin/Glass.git\ncd Glass\npip install -e .            # Python 3.10+ — no deps for the interpreter\n                            # (the native compiler also needs cc + libgc; see docs/getting-started.md)\n\nglass examples/basic/hello.glass\nglass examples/prove/prove_pane.glass   # prove queries over a private table, revealing no rows\nglass                        # or start the REPL\n\n# Prove a function's result, then check the proof with the INDEPENDENT verifier:\nglass prove --emit /tmp/p.txt examples/prove/hello_prove.glass inp=9\nglass verify /tmp/p.txt                 # -\u003e PENTECOST: ACCEPT  (a separate program, no shared code)\n```\n\nPrefer the browser? `python -m http.server` and open\n[`playground.html`](playground.html) — Glass runs fully client-side, no install.\n\n\u003cbr/\u003e\n\n## Where to go\n\n| If you want to… | Go here |\n|---|---|\n| **Learn the language** | [A tour](docs/language-tour.md) · [Getting started](docs/getting-started.md) · [the spec](LANG.md) |\n| **See what it can express** | [`examples/showcase/`](examples/showcase/) |\n| **Watch Glass reconstruct itself** | [Self-hosting](docs/self-hosting.md) · [`examples/selfhost/`](examples/selfhost/) |\n| **See the zero-knowledge prover** | **[Frost — a zk-STARK in Glass](examples/frost/)** · [write Glass, get a proof](examples/prove/) |\n| **Prove a query over private data** | **[Pane ⊕ Frost — the founding payoff](examples/prove/prove_pane.glass)** · [in zero-knowledge](examples/prove/prove_query_zk.glass) |\n| **See a proof checked independently** | **[Pentecost — let the verifier be two](pentecost/)** · [`glass prove --emit` → `glass verify`](pentecost/README.md) |\n| **Read the whole story** | [Glass, end to end](docs/the-story.md) |\n| **Know what a proof here really guarantees** | [Soundness — the honest ledger](docs/soundness.md) |\n| **Know where it's headed** | [Roadmap](docs/roadmap.md) |\n\n\u003cbr/\u003e\n\n## What's in here\n\n```\nglass/\n├── glass.py          # the language — parser, type checker, interpreter (one file)\n├── quartz.py         # the native back end — Glass → C\n├── examples/         # everything below runs with `glass \u003cfile\u003e`\n│   ├── basic/  features/  showcase/  lib/   ·  learn the language\n│   ├── selfhost/  quartz/  stage3/          ·  Glass compiling Glass\n│   └── pane/  frost/  prove/                ·  built in Glass: a query language, a\n│                                                zk-STARK, and a bridge from source to proof\n├── pentecost/        # a second, independent verifier — every proof checked twice\n├── name/ ledger/ seal/   # content-addressed identity · append-only verdict ledger · selective disclosure\n├── fuzz/             # soundness fuzzers — random + adversarial tamper/claim campaigns\n├── docs/             # tour, spec, self-hosting, soundness, roadmap\n├── tests/            # the regression suite (476/476)\n└── playground.html   # browser playground (Pyodide)\n```\n\n\u003cbr/\u003e\n\n## Status\n\nGlass is a research language and a labor of love. It self-hosts, ships 422\npassing tests, runs in the browser, proves the result of a function and has that\nproof re-checked by a second independent verifier, and is the foundation for the\nexperiments in [`examples/frost/`](examples/frost/) and [`examples/prove/`](examples/prove/).\nIt is not production-hardened, and it doesn't pretend to be: every claim above is\na command you can run, and every limit is written down plainly — start with the\n[soundness ledger](docs/soundness.md). Nothing taken on faith, including the faith\nyou'd place in it.\n\n## License\n\nDual-licensed under [MIT](LICENSE-MIT) or [Apache 2.0](LICENSE-APACHE), your choice.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegorkhaklin%2Fglass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fegorkhaklin%2Fglass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegorkhaklin%2Fglass/lists"}