{"id":28197672,"url":"https://github.com/clr1107/lmc-llvm-target","last_synced_at":"2026-04-29T06:37:15.241Z","repository":{"id":188355240,"uuid":"464596784","full_name":"clr1107/lmc-llvm-target","owner":"clr1107","description":"A Little Man Computer assembly compiler target (LLVM)","archived":false,"fork":false,"pushed_at":"2023-02-03T17:45:24.000Z","size":107,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-16T17:15:12.077Z","etag":null,"topics":["compiler","go","golang","little-man-computer","llvm"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clr1107.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-02-28T18:23:22.000Z","updated_at":"2023-01-27T03:43:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"f812231a-4532-43df-8a54-99a829d5b694","html_url":"https://github.com/clr1107/lmc-llvm-target","commit_stats":null,"previous_names":["clr1107/lmc-llvm-target"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/clr1107/lmc-llvm-target","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clr1107%2Flmc-llvm-target","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clr1107%2Flmc-llvm-target/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clr1107%2Flmc-llvm-target/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clr1107%2Flmc-llvm-target/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clr1107","download_url":"https://codeload.github.com/clr1107/lmc-llvm-target/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clr1107%2Flmc-llvm-target/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262811449,"owners_count":23368112,"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":["compiler","go","golang","little-man-computer","llvm"],"created_at":"2025-05-16T17:15:05.009Z","updated_at":"2026-04-29T06:37:10.209Z","avatar_url":"https://github.com/clr1107.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\u003ch1 \u003eLMC-LLVM-Target\u003c/h1\u003e\n\u003cp\u003e\u003csmall\u003e\u003ci\u003eMassive work in progress.\u003c/i\u003e\u003c/small\u003e\u003c/p\u003e\n\u003cimg alt=\"Logo: 'LMC Simulator' executable icon, by Prof Magnus Bordewich, Uni of Durham, overlayed on LLVM logo\" width=\"20%\" src=\"https://i.clr.is/5HHGpYVds.png\" /\u003e\n\u003cp\u003e\u003csmall\u003e(\u003ca href=\"https://mjrbordewich.webspace.durham.ac.uk/lmc/\"\u003e'LMC Simulator'\u003c/a\u003e executable icon by Professor Magnus Bordewich, University of Durham, overlayed on LLVM logo. Temporary, maybe.)\u003c/small\u003e\u003c/p\u003e\n\u003c/div\u003e\n\n## Description\n\nLittle Man Computer (LMC) is an incredibly simple instruction set, used for teaching, that gives a model of a computer  \nin the Von Neumann Architecture. It was first introduced by Dr. Stuart Madnick of M.I.T. in 1965. This program provides\na compiler back-end to translate LLVM's IR to LMC. So, in theory, any language compilable to IR can be compiled to LMC.\nThis project focuses on compiling C to\nLMC. [Here is a list of the instructions.](https://en.wikipedia.org/wiki/Little_man_computer#Instructions) (Note: there\nare two main conventions for instruction mnemonics I've seen. I am using the ones listed on Wikipedia.)\n\nThe purpose of this project is mainly for entertainment. It is quite ridiculous that C could compile to this simple\nand (functionally) useless language. Also, this would have made homework at school and my first year university project\nfar easier.\n\n### Project description\n\nThis project includes two standalone packages: `lmc` which allows the construction, analysis, and optimisation of LMC\nprograms, and `compiler` which will take LLIR and compile it to (unoptimised) LMC instructions. (The `lmc` package can\nthen be used to optimise it.)\n\nOnce the project is at a suitable level of completeness I will include a CLI tool to compile and optimise code from\ninputs. For now, there is a program in `compiler/testing/compiler.go` that gives an incredibly simple example of how\nthis tool may look. It does compilation and optimisation.\n\nThe compiler is really simple. I mean, extremely basic. It performs rudimentary pattern matching on IR instructions,\nconverts them to LMC instructions, producing some of the worst LMC in existence, before optimising it.\n\nLMC typically has a limit of 100 mailboxes, however this is not observed or worried about in this project. Mainly\nbecause I can't be bothered to include that limitation, and my excuse is I am treating it as RAM; a program does not\nknow ahead of time how large its target device's RAM will be, so neither does this compiler.\n\n## LMC Package\n\nAn overview and examples of the `lmc` package.\n\n### Memory\n\n*TODO*\n\n### Utility functions\n\n*TODO*\n\n### Constructing a program\n\n*TODO*\n\n### Optimising a program\n\n*TODO*\n\n## Compiler package\n\nAn overview and examples of the `compiler` package. For details of optimisation algorithms included\nsee [`lmc/optimisation/OPTIMISTAION.md`](lmc/optimisation/OPTIMISATION.md)\n\n### Steps of the compiler\n\n*TODO*\n\n### LMC header file (`lmc.h`)\n\n[`compiler/lmc.h`](compiler/lmc.h) contains some very useful macros and builtin functions. These functions are\nmarked `extern` and when pattern matched are, essentially, drop-in replaced by some LMC instructions. There are two\ntypes that are _recommended_ to be used when creating a program: `number_t` and `bool_t`.\n\nAlso included in this header file is the entry point to any LMC program, `void _lmc(void)`.\n\n### How to use the compiler\n\n*TODO*\n\n## All round examples\n\n*TODO*\n\n### Optimising a program\n\n*TODO*\n\n### Compiling and optimising a program\n\n*TODO*\n  \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclr1107%2Flmc-llvm-target","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclr1107%2Flmc-llvm-target","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclr1107%2Flmc-llvm-target/lists"}