{"id":19574534,"url":"https://github.com/dmaivel/pyvscc","last_synced_at":"2025-05-10T21:03:39.241Z","repository":{"id":172301967,"uuid":"649109195","full_name":"dmaivel/pyvscc","owner":"dmaivel","description":"Experimental python to native x86-64 compiler","archived":false,"fork":false,"pushed_at":"2024-05-28T00:12:41.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-09T17:11:51.156Z","etag":null,"topics":["assembly","compiler","python","x86","x86-64"],"latest_commit_sha":null,"homepage":"","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/dmaivel.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":"2023-06-03T20:06:07.000Z","updated_at":"2024-12-14T15:24:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"9c773b92-42d7-4b50-bedf-ab0b93651a37","html_url":"https://github.com/dmaivel/pyvscc","commit_stats":null,"previous_names":["dmaivel/pyvscc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmaivel%2Fpyvscc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmaivel%2Fpyvscc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmaivel%2Fpyvscc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmaivel%2Fpyvscc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmaivel","download_url":"https://codeload.github.com/dmaivel/pyvscc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253292131,"owners_count":21885037,"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":["assembly","compiler","python","x86","x86-64"],"created_at":"2024-11-11T06:42:30.644Z","updated_at":"2025-05-09T17:11:59.528Z","avatar_url":"https://github.com/dmaivel.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg align=\"right\" width=\"18%\" src=\"https://cdn-icons-png.flaticon.com/512/427/427533.png\"\u003e\n\n# pyvscc ![license](https://img.shields.io/badge/license-MIT-blue)\n\nExperimental, no dependencies, python compiler for the x86-64 architecture on linux, utilizing [vscc](https://www.github.com/dmaivel/vscc) for bytecode generation. This project is largely unfinished and is primarly a proof of concept.\n\n## build (cmake)\n```bash\ngit clone --recurse-submodules https://github.com/dmaivel/pyvscc.git\ncd pyvscc\nmkdir build\ncd build\ncmake ..\ncmake --build . --config Release\n```\n\n## usage\n```\nusage: pyvscc [-h] [-i FILE_PATH] [-e ENTRY_POINT] [-m SIZE] [-s SIZE] [-o] [-p]\n\noptions:\n    -h                   display help information\n    -i [FILE_PATH]       input file path\n    -e [ENTRY_POINT]     specify entry function (if not specified, searches for any function containing 'main')\n    -m [SIZE]            max amount of bytes program may allocate (default: 4096 bytes)\n    -s [SIZE]            amount of bytes variables/functions with an unspecified type take up (default: 8 bytes)\n    -o                   enable optimizations\n    -p                   print performance information\n```\n\n## features\n### demo\nCurrently, this compiler is able to compile and execute the following example effortlessly (tabs must be U+0009):\n```python\ndef play(y):\n\tif y == 3:\n\t\treturn 11\n\treturn 10\n\ndef main():\n\tx = play(4)\n\tif x != 11:\n\t\tprint('hello world!\\n')\n\treturn x\n```\n\u003cdetails\u003e\n\u003csummary\u003eClick to reveal: disassembly of compiled output\u003c/summary\u003e\n\t\n```assembly\n; pyimpl_strlen(i64)\n0:  55                      push   rbp\n1:  48 89 e5                mov    rbp,rsp\n4:  48 83 ec 11             sub    rsp,0x11\n8:  48 89 7d f8             mov    QWORD PTR [rbp-0x8],rdi\nc:  48 c7 45 f0 00 00 00    mov    QWORD PTR [rbp-0x10],0x0\n13: 00\n14: 48 8b 45 f8             mov    rax,QWORD PTR [rbp-0x8]\n18: 8a 00                   mov    al,BYTE PTR [rax]\n1a: 88 45 ef                mov    BYTE PTR [rbp-0x11],al\n1d: 80 7d ef 00             cmp    BYTE PTR [rbp-0x11],0x0\n21: 0f 84 0f 00 00 00       je     0x36\n27: 48 83 45 f8 01          add    QWORD PTR [rbp-0x8],0x1\n2c: 48 83 45 f0 01          add    QWORD PTR [rbp-0x10],0x1\n31: e9 de ff ff ff          jmp    0x14\n36: 48 8b 45 f0             mov    rax,QWORD PTR [rbp-0x10]\n3a: 48 83 c4 11             add    rsp,0x11\n3e: 5d                      pop    rbp\n3f: c3                      ret\n; pyimpl_print_str(i64)\n40: 55                      push   rbp\n41: 48 89 e5                mov    rbp,rsp\n44: 48 83 ec 10             sub    rsp,0x10\n48: 48 89 7d f8             mov    QWORD PTR [rbp-0x8],rdi\n4c: 48 8b 7d f8             mov    rdi,QWORD PTR [rbp-0x8]\n50: e8 ab ff ff ff          call   0x0\n55: 48 89 45 f0             mov    QWORD PTR [rbp-0x10],rax\n59: 48 c7 c7 01 00 00 00    mov    rdi,0x1\n60: 48 8b 75 f8             mov    rsi,QWORD PTR [rbp-0x8]\n64: 48 8b 55 f0             mov    rdx,QWORD PTR [rbp-0x10]\n68: 48 c7 c0 01 00 00 00    mov    rax,0x1\n6f: 0f 05                   syscall\n71: 48 8b 45 f0             mov    rax,QWORD PTR [rbp-0x10]\n75: 48 83 c4 10             add    rsp,0x10\n79: 5d                      pop    rbp\n7a: c3                      ret\n; play(i64)\n7b: 55                      push   rbp\n7c: 48 89 e5                mov    rbp,rsp\n7f: 48 83 ec 08             sub    rsp,0x8\n83: 48 89 7d f8             mov    QWORD PTR [rbp-0x8],rdi\n87: 48 83 7d f8 03          cmp    QWORD PTR [rbp-0x8],0x3\n8c: 0f 85 0a 00 00 00       jne    0x9c\n92: b8 0b 00 00 00          mov    eax,0xb\n97: e9 05 00 00 00          jmp    0xa1\n9c: b8 0a 00 00 00          mov    eax,0xa\na1: 48 83 c4 08             add    rsp,0x8\na5: 5d                      pop    rbp\na6: c3                      ret\n; main()\na7: 55                      push   rbp\na8: 48 89 e5                mov    rbp,rsp\nab: 48 83 ec 18             sub    rsp,0x18\naf: 48 c7 c7 04 00 00 00    mov    rdi,0x4\nb6: e8 c0 ff ff ff          call   0x7b\nbb: 48 89 45 f8             mov    QWORD PTR [rbp-0x8],rax\nbf: 48 83 7d f8 0b          cmp    QWORD PTR [rbp-0x8],0xb\nc4: 0f 84 18 00 00 00       je     0xe2\nca: 48 8d 05 2b 00 00 00    lea    rax,[rip+0x2b]        # 0xfc\nd1: 48 89 45 f0             mov    QWORD PTR [rbp-0x10],rax\nd5: 48 8b 7d f0             mov    rdi,QWORD PTR [rbp-0x10]\nd9: e8 62 ff ff ff          call   0x40\nde: 48 89 45 e8             mov    QWORD PTR [rbp-0x18],rax\ne2: 48 8b 45 f8             mov    rax,QWORD PTR [rbp-0x8]\ne6: 48 83 c4 18             add    rsp,0x18\nea: 5d                      pop    rbp\neb: c3                      ret\n...\n```\n\t\n\u003c/details\u003e\n\n### explicit types\nThe following explicit types may be used: `byte`, `word`, `dword`, and `qword`, each representing a sigle byte, two bytes, four bytes, and eight byte values respectively.\n```python\ndef main(x: qword) -\u003e dword:\n    # ...\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmaivel%2Fpyvscc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmaivel%2Fpyvscc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmaivel%2Fpyvscc/lists"}