{"id":13648133,"url":"https://github.com/xfgusta/cexpl","last_synced_at":"2025-10-26T20:11:15.832Z","repository":{"id":58677288,"uuid":"533096514","full_name":"xfgusta/cexpl","owner":"xfgusta","description":"Command-line tool to interact with Compiler Explorer","archived":false,"fork":false,"pushed_at":"2022-12-23T03:14:40.000Z","size":69,"stargazers_count":31,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-10T22:09:13.479Z","etag":null,"topics":["cli","command-line","compilation","compiler","compiler-explorer","godbolt","terminal"],"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/xfgusta.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}},"created_at":"2022-09-05T23:55:18.000Z","updated_at":"2024-10-01T07:58:53.000Z","dependencies_parsed_at":"2023-01-30T17:31:28.808Z","dependency_job_id":null,"html_url":"https://github.com/xfgusta/cexpl","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/xfgusta%2Fcexpl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xfgusta%2Fcexpl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xfgusta%2Fcexpl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xfgusta%2Fcexpl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xfgusta","download_url":"https://codeload.github.com/xfgusta/cexpl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235718832,"owners_count":19034670,"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":["cli","command-line","compilation","compiler","compiler-explorer","godbolt","terminal"],"created_at":"2024-08-02T01:03:59.666Z","updated_at":"2025-10-08T14:30:37.937Z","avatar_url":"https://github.com/xfgusta.png","language":"Python","readme":"# cexpl\n\nCommand-line tool to interact with [Compiler Explorer](https://godbolt.org/).\n\n[![asciicast](https://asciinema.org/a/525454.svg)](https://asciinema.org/a/525454)\n\n## Installation\n\n### Arch Linux\n\n[**cexpl**](https://aur.archlinux.org/packages/cexpl) package from AUR\n\n```text\ngit clone https://aur.archlinux.org/cexpl.git\ncd cexpl\nmakepkg -si\n```\n\n### Fedora Linux\n\n[**cexpl**](https://copr.fedorainfracloud.org/coprs/xfgusta/cexpl/) package from Copr\n\n```text\ndnf copr enable xfgusta/cexpl\ndnf install cexpl\n```\n\n### PyPI\n\n[**cexpl**](https://pypi.org/project/cexpl/) package from PyPI\n\n```text\npip install --user cexpl\n```\n\n## Overview\n\n**cexpl** is able to query all available languages, compilers, build and execute your source code. You can also give some extra arguments, like compiler flags, command-line arguments and STDIN.\n\nThe Compiler Explorer API host can be specified with the `-H`/`--host` option.\n\n### List available languages\n\nThe `--list-langs` option lists all languages and their IDs:\n\n```text\n$ cexpl --list-langs\nada - Ada\nanalysis - Analysis\nassembly - Assembly\nc - C\nc++ - C++\ncarbon - Carbon\ncircle - C++ (Circle)\ncirct - CIRCT\nclean - Clean\ncpp2_cppfront - Cpp2-cppfront\n...\n```\n\nThe language ID can be used with the `-l`/`--lang` option.\n\n### List available compilers\n\nThe `--list-compilers` option lists all compilers and their IDs:\n\n```text\n$ cexpl --list-compilers\n386_gl114 - 386 gc 1.14\n386_gl115 - 386 gc 1.15\n386_gl116 - 386 gc 1.16\n386_gl117 - 386 gc 1.17\n386_gl118 - 386 gc 1.18\n386_gl119 - 386 gc 1.19\n386_gltip - 386 gc (tip)\n6g141 - amd64 gc 1.4.1\naarchg54 - ARM64 gcc 5.4\narduinomega189 - Arduino Mega (1.8.9)\n...\n```\n\nIt is also possible to list the compilers for a specific language. For example, `cexpl --list-compilers python` will list all available Python compilers.\n\nThe compiler ID can be used with the `-c`/`--compiler` option.\n\n### Compilation and execution\n\nIn order to compile, you need to pass the file containing the source code. **cexpl** will try to figure out the language and its default compiler based on the file extension. You can specify the language and/or the compiler with `--lang` and/or `--compiler` option, as said above.\n\n```text\n$ cexpl love.c\n.LC0:\n        .string \"\u003c3\"\nmain:\n        push    rbp\n        mov     rbp, rsp\n        mov     edi, OFFSET FLAT:.LC0\n        call    puts\n        mov     eax, 0\n        pop     rbp\n        ret\n```\n\nThe source code:\n\n```c\n#include \u003cstdio.h\u003e\n\nint main() {\n    printf(\"\u003c3\\n\");\n    return 0;\n}\n```\n\nYou can pass options to the compiler with the `--cflags` option.\n\n#### Comparing source code and assembly\n\nUse the `-C`/`--compare` option to compare the source code with the assembly:\n\n```text\n$ cexpl --compare --cflags=-Ofast love.c\n.LC0:\n        .string \"\u003c3\"\nmain:\n3 int main() {\n        sub     rsp, 8\n4 printf(\"\u003c3\\n\");\n        mov     edi, OFFSET FLAT:.LC0\n        call    puts\n6 }\n        xor     eax, eax\n        add     rsp, 8\n        ret\n```\n\n#### Execution\n\nThe `-e`/`--exec` option executes the code:\n\n```text\n$ cexpl --exec --skip-asm love.c\nSTDOUT:\n\u003c3\n```\n\nIf you don't want to see the generated assembly, use the `-s`/`--skip-asm` option.\n\n##### Arguments and input\n\nYou can pass a list of arguments with the `-a`/`--args` option. For example, `cexpl --args one two three --exec main.c`. The same applies to the `--stdin` option:\n\n```text\n$ cexpl --skip-asm --exec --stdin \"Gustavo Costa\" 20 -- hi.py\nSTDOUT:\nGustavo Costa, 20 years old\n```\n\nThe source code:\n\n```python\nname = input()\nage = input()\nprint(f'{name}, {age} years old')\n```\n\n#### Saving your results\n\nYou can generate a short link for the compilation with the `-L`/`--link` option.\n\n## License\n\nCopyright (c) 2022 Gustavo Costa. Distributed under the MIT license.\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxfgusta%2Fcexpl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxfgusta%2Fcexpl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxfgusta%2Fcexpl/lists"}