{"id":18858060,"url":"https://github.com/kvbc/lamp","last_synced_at":"2026-07-23T01:31:37.349Z","repository":{"id":41399349,"uuid":"507342492","full_name":"kvbc/lamp","owner":"kvbc","description":"Minecraft CarpetMod standalone turing-complete vanilla command-block array-based CPU generator","archived":false,"fork":false,"pushed_at":"2022-07-28T11:22:33.000Z","size":2255,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-10T06:14:56.910Z","etag":null,"topics":["carpet-mod","cpu","minecraft","turing-complete"],"latest_commit_sha":null,"homepage":"","language":"Python","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/kvbc.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}},"created_at":"2022-06-25T15:08:01.000Z","updated_at":"2022-07-02T10:13:10.000Z","dependencies_parsed_at":"2022-09-16T13:47:13.248Z","dependency_job_id":null,"html_url":"https://github.com/kvbc/lamp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kvbc/lamp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvbc%2Flamp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvbc%2Flamp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvbc%2Flamp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvbc%2Flamp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kvbc","download_url":"https://codeload.github.com/kvbc/lamp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvbc%2Flamp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35784494,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-22T02:00:06.236Z","response_time":124,"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":["carpet-mod","cpu","minecraft","turing-complete"],"created_at":"2024-11-08T04:09:49.069Z","updated_at":"2026-07-23T01:31:37.305Z","avatar_url":"https://github.com/kvbc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lamp\r\n\r\nMinecraft [CarpetMod](https://github.com/gnembon/fabric-carpet) standalone turing-complete vanilla command-block array-based CPU generator\r\n\r\nThe generator is written in [scarpet](https://github.com/gnembon/fabric-carpet/tree/master/docs/scarpet) using [CarpetMod](https://github.com/gnembon/fabric-carpet)  \r\nAssembly is written in JSON so maybe one day, with enough instructions, it would be possible to transpile [LUA's](https://www.lua.org/) bytecode to it. Which would be the ultimate goal of this project\r\n\r\nThe assembly language is array-based and it provides\r\n- basic stack manipulation instructions (`push` and `pop` instructions)\r\n- primitive usage of \"variables\" (`get` and `set` instructions)\r\n- basic arithmetics (`add` and `sub` instructions)\r\n- conditional jumps\r\n- subroutines  \r\n\r\n![](https://raw.githubusercontent.com/kvbc/kvbc/main/gif/lamp.gif)  \r\n*The ALU (Arithmetic Logic Unit) in action*\r\n\r\n# Sections\r\n\r\n- [Synopsis](#synopsis)\r\n- [Instruction Set](#instruction-set)\r\n  - [Memory manipulation](#memory-manipulation)\r\n  - [Control flow](#control-flow)\r\n  - [Arithmetic](#arithmetic)\r\n- [TO-DO](#to-do)\r\n\r\n# Synopsis\r\n\r\nThe first 10 fibonacci numbers - [Video Showcase](https://www.youtube.com/watch?v=NvBEsQZ-E2s)\r\n```as\r\njmp main\r\nlbl loop\r\n  pop //get 0\r\n  add\r\n  get 0 //10\r\n  push 1\r\n  sub\r\n  set 0\r\n  pop\r\n  pop\r\n  jnz loop\r\nlbl main\r\n  push 10\r\n  push 1\r\n  push 1\r\n  push 69 //dummy for 1st pop in :loop\r\n  jmp loop\r\n```\r\n\r\n# Instruction Set\r\n\r\n- `number` — `[0-9]+`\r\n- `char` — `'.'`\r\n- `name`   — `[_a-zA-Z][_a-zA-Z0-9]*`\r\n- `value`  — Either `number`, `char` or `name` (constant)\r\n- `idx` — `value`, 0-based index from the bottom of the stack\r\n- `[...]` - optional argument, if not present, taken from the stack\r\n- `A` - top value on the stack\r\n- `B` - second-top value on the stack\r\n\r\n\u003c!-- TODO: const --\u003e\r\n\r\n### Memory manipulation\r\n\r\n| Instruction          | Description |\r\n| :------------------: | :---------- |\r\n| push `value`         | Push `value` onto the top of the stack\r\n| pop                  | Discard the top element of the stack \u003cbr\u003e 📝 No other instruction can pop a value off the stack\r\n| get `[idx]`          | Push element at `idx` onto the top of the stack\r\n| set `[idx] [value]`  | Set element at `idx` to `value`\r\n\u003c!-- TODO: del --\u003e\r\n\r\n### Control flow\r\n\r\n| Instruction | Description |\r\n| :---------: | :---------- |\r\n| lbl `name`  | Define a new label of ID `name`\r\n| call `name` | Call the subroutine at label `name`\r\n| ret         | Return from the current subroutine\r\n| jmp `name`  | Jump to label `name`\r\n| je `name`   | Jump to label `name` if `A == B`\r\n| jne `name`  | Jump to label `name` if `A != B`\r\n| jg `name`   | Jump to label `name` if `A \u003e  B`\r\n| jge `name`  | Jump to label `name` if `A \u003e= B`\r\n| jl `name`   | Jump to label `name` if `A \u003c  B`\r\n| jle `name`  | Jump to label `name` if `A \u003c= B`\r\n| jz `name`   | Jump to label `name` if `A == 0`\r\n| jnz `name`  | Jump to label `name` if `A != 0`\r\n\r\n### Arithmetic\r\n\r\n| Instruction | Description |\r\n| :---------: | :---------- |\r\n| add         | Push `A + B`\r\n| sub         | Push `A - B`\r\n\u003c!-- TODO: mul, div --\u003e\r\n\r\n# TO-DO\r\n\r\n- Clean up the scarpet code\r\n- Clean up this readme\r\n- Actually handle `char` cuz I don't think it's working\r\n- Make conditional jumps pop off their `A`s and `B`s\r\n- Create a `const` instruction for setting constants\r\n- Create an `idx` instruction that pushes the top index\r\n- Create `mul` and `div` instructions for multiplication and division\r\n- Perhaps create a `del` instruction that would remove an element at a specified index\r\n- Perhaps create a `put` instruction that would place a specified block at the given `x y z` coordinates (good luck with that)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkvbc%2Flamp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkvbc%2Flamp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkvbc%2Flamp/lists"}