{"id":15060270,"url":"https://github.com/robertmuth/cwerg","last_synced_at":"2025-04-08T02:36:26.554Z","repository":{"id":39533291,"uuid":"223616426","full_name":"robertmuth/Cwerg","owner":"robertmuth","description":"The best C-like language that can be implemented in 10kLOC.","archived":false,"fork":false,"pushed_at":"2025-03-25T20:38:22.000Z","size":28894,"stargazers_count":565,"open_issues_count":21,"forks_count":15,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-01T01:36:40.531Z","etag":null,"topics":["arm","arm64","assembler","compiler","elf","ir-optimizer","low-level-programming","x86-64"],"latest_commit_sha":null,"homepage":"","language":"Assembly","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robertmuth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-23T16:08:13.000Z","updated_at":"2025-03-31T13:55:55.000Z","dependencies_parsed_at":"2024-08-26T04:56:45.443Z","dependency_job_id":"10b2115c-2afd-4d94-8149-c94fc5420156","html_url":"https://github.com/robertmuth/Cwerg","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertmuth%2FCwerg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertmuth%2FCwerg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertmuth%2FCwerg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertmuth%2FCwerg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robertmuth","download_url":"https://codeload.github.com/robertmuth/Cwerg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247765587,"owners_count":20992328,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["arm","arm64","assembler","compiler","elf","ir-optimizer","low-level-programming","x86-64"],"created_at":"2024-09-24T22:55:28.512Z","updated_at":"2025-04-08T02:36:26.527Z","avatar_url":"https://github.com/robertmuth.png","language":"Assembly","readme":"# Cwerg\n\n## The best C-like language that can be implemented in 10kLOC\n\n![Status](../../workflows/cwerg-tests/badge.svg)\n[![GitHub stars](https://img.shields.io/github/stars/robertmuth/Cwerg.svg?label=github%20stars)](https://github.com/robertmuth/Cwerg/stargazers)\n[![Discord](https://img.shields.io/discord/1266057429091881011?logo=discord\u0026style=flat)](https://discord.com/channels/1266057429091881011/)\n\nCwerg aims to be a complete, compact and fast \"from-scratch\" compiler for a C-like language.\nIt has no dependencies and consists of the following components:\n* **[Frontend FE/](FE/)**: [Overview](FE/Docs/tutorial.md), [Additional Docs](FE/Docs/)\n\n  A low-level C-like language with a Python inspired concrete syntax.\n  Still under active development\n\n\n* **[Backend BE/](BE/)**: [Overview](BE/README.md),  [Backend IR](BE/Docs/opcodes.md), [Additional Docs](BE/Docs/)\n\n  Muti-target (currently: X86-64, Aarch64, Arm32).\n\n  Also suitable for other compilers and as a JIT.\n\n  Defines an IR that serves as the interface between frontend and backend.\n\nTo get started hacking on Cwerg please read [getting_started.md](getting_started.md).\n\n## Philosophy\n\nMost components are implemented twice (see [rationale](why_python.md)):\n1. spec/reference implementation: Python 3.10\n2. high performance implementation: C++20 (with limited STL usage)\n\nRe-implementations in other languages are explicitly encouraged.\nA lot of code is table driven to facilitate that.\n\nCwerg de-emphasizes quality of the generated code (the hope is to come within 50%\nof state of the art compilers) in favor of a small code base that can be\nunderstood by a single developer and very fast translation times.\n\nExplicit line number targets are in place to prevent feature creep:\n* frontend: 10kLOC\n  ([current counts](FE/CLOC.md))\n* backend 10kLOC (target independent code) + 5kLOC(per target\n  ([current counts](BE/CLOC.md))\n\nThe translation speed target is 1000k LOC per sec using at most 4 cores \non a 2020 era midrange desktop or high end laptop.\n\n## Inspirations\n\n* [LLVM](https://llvm.org)\n* [QBE](https://c9x.me/compile/) ([QBE vs LLVM](https://c9x.me/compile/doc/llvm.html))\n* [Mir](https://github.com/vnmakarov/mir) ([blog post](https://developers.redhat.com/blog/2020/01/20/mir-a-lightweight-jit-compiler-project/))\n* [Wirth: A Plea for Lean Software](https://cr.yp.to/bib/1995/wirth.pdf),\n  [Oberon](http://www.projectoberon.com/) ([compiler implementation](http://www.inf.ethz.ch/personal/wirth/ProjectOberon/PO.System.pdf))\n* [Delphi's compilation speed](https://news.ycombinator.com/item?id=24735366)\n* [gcc code size](https://www.phoronix.com/scan.php?page=news_item\u0026px=MTg3OTQ)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertmuth%2Fcwerg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobertmuth%2Fcwerg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertmuth%2Fcwerg/lists"}