{"id":24423961,"url":"https://github.com/mopp/9mm","last_synced_at":"2025-04-12T07:51:09.704Z","repository":{"id":149753401,"uuid":"186209393","full_name":"mopp/9mm","owner":"mopp","description":"Hobby C Compiler","archived":false,"fork":false,"pushed_at":"2019-07-23T17:11:00.000Z","size":307,"stargazers_count":22,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T03:04:28.084Z","etag":null,"topics":["c","compiler","hobby-compiler","hobby-project","self-hosted"],"latest_commit_sha":null,"homepage":null,"language":"C","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/mopp.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-05-12T04:00:07.000Z","updated_at":"2023-07-25T14:25:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"0f00dc98-353e-4077-ab59-0d8209f9eca3","html_url":"https://github.com/mopp/9mm","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/mopp%2F9mm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mopp%2F9mm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mopp%2F9mm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mopp%2F9mm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mopp","download_url":"https://codeload.github.com/mopp/9mm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248537003,"owners_count":21120688,"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":["c","compiler","hobby-compiler","hobby-project","self-hosted"],"created_at":"2025-01-20T10:48:22.862Z","updated_at":"2025-04-12T07:51:09.699Z","avatar_url":"https://github.com/mopp.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 9mm\nHobby C (subset) Compiler  \n`9mm` can compile itself.\n\n\n## How to build/test\n```console\n\u003e make 9mm\n\n\u003e ./9mm\nUsage:\n  ./9mm [--test] [--str 'your program'] [FILEPATH]\n\n  --test run test\n  --str  input c codes as a string\n\n# test \"9mm\"\n\u003e make test\n\n# Build \"9mms\" which is selfhosted 9mm.\n\u003e make selfcompile\n\n# Test it.\n\u003e make test TEST_9MM=./9mms\n```\n\n## Production rule\n```txt\nprogram    = global\nglobal     = (decl_var \";\")* |\n             function* |\n             struct* |\n             enum* |\n             \"typedef\" struct ident ident \";\"\n             \"expern\" type \";\"\nstruct     = \"struct\" ident \";\"\n             \"struct\" ident \"{\" decl_var; \"}\" \";\"\nenum       = \"enum\" \"{\" (ident (= num)? \",\")+ ident (= num)? \"}\" \";\"\nfunction   = type ident \"(\" (decl_var (\",\" decl_var)*)* \")\" block\n             type ident \"(\" (decl_var (\",\" decl_var)*)* \")\";\nblock      = \"{\" stmt* \"}\"\nstmt       = \"if\" \"(\" expr \")\" stmt (\"else\" stmt)? |\n             \"while\" \"(\" expr \")\" stmt |\n             \"for\" \"(\" expr? \";\" expr? \")\" stmt |\n             block |\n             \"return\" expr? \";\" |\n             expr \";\" |\n             \"break\" \";\"\nexpr       = (\"(\" type \")\")? assign\nassign     = and ((\"=\" | \"+=\" | \"-=\" | \"*=\" | \"/=\") expr)?\nand        = equality ((\"\u0026\u0026\" | \"||\") and)?\nequality   = relational (\"==\" relational | \"!=\" relational)*\nrelational = add (\"\u003c\" add | \"\u003c=\" add | \"\u003e\" add | \"\u003e=\" add)*\nadd        = mul (\"+\" mul | \"-\" mul)*\nmul        = unary (\"*\" unary | \"/\" unary)*\nunary      = \"sizeof\" \"(\" unary | \"struct\" ident )\" |\n             (\"+\" | \"-\" | \"\u0026\" | \"*\" | \"!\")? term\nterm       = num |\n             ident \"(\" (expr (\",\" expr)*)* \")\" |\n             (\"++\" | \"--\")* ref_var |\n             decl_var |\n             \"(\" expr \")\ndecl_var   = type ident (\"[\" num \"]\")\nref_var    = ident ( (\"[\" expr \"]\")? ((\".\" | \"-\u003e\") ident)? )* (\"++\" | \"--\")*\ntype       = \"static\"? \"struct\"? ident (\"const\"+ \"*\")*\nident      = chars (chars | num)+\nchars      = [a-zA-Z_]\nnum        = [0-9]+\n```\n\n\n# Acknowledge and Reference\n- [低レイヤを知りたい人のためのCコンパイラ作成入門](https://www.sigbus.info/compilerbook).\n\n\n# License\nThe MIT License (MIT)  \nSee [LICENSE](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmopp%2F9mm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmopp%2F9mm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmopp%2F9mm/lists"}