{"id":17013676,"url":"https://github.com/craftablescience/armcomp","last_synced_at":"2025-10-19T20:02:34.216Z","repository":{"id":104512767,"uuid":"553357445","full_name":"craftablescience/armcomp","owner":"craftablescience","description":"A basic language that compiles to ARM assembly so I can write less assembly!","archived":false,"fork":false,"pushed_at":"2022-10-29T01:32:30.000Z","size":82,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T09:05:33.615Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/craftablescience.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,"zenodo":null}},"created_at":"2022-10-18T05:01:35.000Z","updated_at":"2022-10-29T05:26:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"395198d3-f51f-43bc-8f37-d69952873899","html_url":"https://github.com/craftablescience/armcomp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftablescience%2Farmcomp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftablescience%2Farmcomp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftablescience%2Farmcomp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftablescience%2Farmcomp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/craftablescience","download_url":"https://codeload.github.com/craftablescience/armcomp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248543849,"owners_count":21121838,"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":[],"created_at":"2024-10-14T06:13:56.418Z","updated_at":"2025-10-19T20:02:34.126Z","avatar_url":"https://github.com/craftablescience.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# armcomp\nA basic language that compiles to ARM assembly so I can write less assembly!\n\n## requirements\nPython 3.6 or greater must be installed to use this application.\nThe code may rely on C++20 features, I haven't checked. You will need at least a C++17 capable compiler.\n\n## acknowledgements\nWithout ARMSim there would have been no way to run the generated assembly program. To the people that worked on that, thank you ♥️\n\n## commands\n- `if` - Execute the inner code if the condition is true\n- `while` - Run the inner code until the condition is false\n- `func` - Create a new function with optional arguments\n- `return` - Optionally return a value from a function, or exit the function early\n- `asm` - Insert raw assembly. Variables wrapped in `${}` are converted to the register they represent\n- `end` - Ends a block statement (`if`, `while`, `func`, `asm`)\n- `let` - Create a new variable\n- `label` - Insert a label at this position\n- `goto` - Jump to a given label\n- `print` - Print the given string\n- `println` - Print the given string, with a newline inserted at the end (for convenience)\n- `exit` - Exit the program, with an optional return value\n- `\u003cvariable name here\u003e` - Modify a variable\n- `\u003cfunction name here\u003e` - Execute a function that has been defined. Anything returned is stored in the special `_` variable\n\n## sample code\nSee also: [the \"standard library\"](https://github.com/craftablescience/armcomp/blob/main/src/prelude.hpp)\n\nThis example code:\n```fs\nlet x = 12\nlet y = x\nx = y + 8\ny = x * x\n\nfunc important_check in\n    if in == 20\n        println \"x is currently 20!\"\n    end\nend\n\nimportant_check x\n\nwhile y \u003e x\n    x += 100\n    println \"BUNP\"\nend\n\nprintln \"that's all folks!\"\nexit x\n```\nTurns into this ARM assembly code:\n```arm\n.text\n.global _start\n_start:\n\tmov x11, #12\n\tmov x12, x11\n\tadd x9, x12, #8\n\tmov x11, x9\n\tmul x9, x11, x11\n\tmov x12, x9\n\tmov x0, x11\n\tstr x11, [sp, #-0x10]!\n\tstr x12, [sp, #-0x10]!\n\tbl important_check\n\tldr x12, [sp], #0x10\n\tldr x11, [sp], #0x10\n._while1:\n\tcmp x12, x11\n\tble ._while2\n\tadd x11, x11, #100\n\tmov x0, #1\n\tldr x1, =_str1\n\tldr x2, =_str1_len\n\tmov x8, 0x40\n\tsvc 0\n\tb ._while1\n._while2:\n\tmov x0, #1\n\tldr x1, =_str2\n\tldr x2, =_str2_len\n\tmov x8, 0x40\n\tsvc 0\n\tmov x0, x11\n\tmov x8, #93\n\tsvc 0\n\tb ._proc_end\nimportant_check:\n\tstr lr, [sp, #-0x10]!\n\tmov x11, x0\n\tcmp x11, #20\n\tbne ._if0\n\tmov x0, #1\n\tldr x1, =_str0\n\tldr x2, =_str0_len\n\tmov x8, 0x40\n\tsvc 0\n._if0:\n\tldr lr, [sp], #0x10\n\tret\n._proc_end:\n.data\n_str0: .asciz \"x is currently 20!\\n\"\n_str0_len = .-_str0\n_str1: .asciz \"BUNP\\n\"\n_str1_len = .-_str1\n_str2: .asciz \"that's all folks!\\n\"\n_str2_len = .-_str2\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraftablescience%2Farmcomp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcraftablescience%2Farmcomp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraftablescience%2Farmcomp/lists"}