{"id":13667348,"url":"https://github.com/iiicp/lcc","last_synced_at":"2025-04-26T15:32:42.981Z","repository":{"id":65713087,"uuid":"535686974","full_name":"iiicp/lcc","owner":"iiicp","description":"llvm-based c compiler","archived":false,"fork":false,"pushed_at":"2023-08-30T13:18:07.000Z","size":536,"stargazers_count":93,"open_issues_count":0,"forks_count":17,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-11-11T02:35:40.097Z","etag":null,"topics":[],"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/iiicp.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}},"created_at":"2022-09-12T13:45:12.000Z","updated_at":"2024-10-06T17:32:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"0fbc4ea7-2843-461a-896c-332da836197e","html_url":"https://github.com/iiicp/lcc","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iiicp%2Flcc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iiicp%2Flcc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iiicp%2Flcc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iiicp%2Flcc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iiicp","download_url":"https://codeload.github.com/iiicp/lcc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251008873,"owners_count":21522194,"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-08-02T07:00:35.479Z","updated_at":"2025-04-26T15:32:41.158Z","avatar_url":"https://github.com/iiicp.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# lcc: A Based Of LLVM C Compiler\n\nThis is the source code Tutorial. Lcc is based llvm c99 compiler. You can click [this][1] to visit my video and this compiler tutorial.\n\nThis project will implement almost all ISO C99 syntax and can work on Windows, Linux and Mac OS X.\n\nISO C 99 Doc link (pdf file): [C99](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf)\n\n## Current Status: \n\n|  Module     | Status     |     \n|  ----       |------------|   \n| Preprocess  | working... |   \n| Lexer       | 100%       |      \n| Parser      | 100%       |       \n| Semantics   | 5%         |       \n| CodeGen     | working... |    \n\n## Test Status:\n\ncatch2 will be integrated in the future\n\n\n## Compile and Run\n\n### Install the latest LLVM library or Build LLVM manually\n\n一：Install the latest LLVM library\n\n```   \nMac:\n----------------------\n1, install homebrew \nreference: https://brew.sh/\nor reference: https://brew.idayer.com/\n\n2, brew install llvm\n\nLinux:\n----------------------\n1, sudo apt-get update\n2, sudo apt-get -y install llvm-12\n\nWindows:\n----------------------\nreference:  https://blog.csdn.net/kingfox/article/details/117450533\n```\n\n二：Build LLVM manually\n\n```\ngit clone https://github.com/llvm/llvm-project.git\ncd llvm-project/llvm  \u0026\u0026 mkdir llvm_install_dir \u0026\u0026 mkdir build\ncd build\ncmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../llvm_install_dir ../llvm\n```\n\n\n### How to use lcc\n\n一：Compile\n\n```\n1, git clone git@github.com:iiicp/lcc.git\n2, cd lcc \u0026\u0026 mkdir build \u0026\u0026 cd build \n3, cmake -GNinja -DLLVM_DIR=\"Path to Your LLVM CMake dir\" ..\n4, ninja \n```\n\n二：Run\n\nlcc support --dumpTokens and --dumpAst command line options\n```  \n./lcc --help\n./lcc -emit-tokens ../tests/c/stmt.c\n./lcc -emit-ast ../tests/c/stmt.c \n```\n\n## lcc unsupported c99 language features\n\n1. unicode char     \n2. _Complex      \n3. direct-declarator ( identifier-list{opt} )     \neg: int f(a, b) int a,b {return a+b;}\n\n\n## Reference   \n\n- [cld](https://github.com/zero9178/cld)        \n- [chibicc](https://github.com/rui314/chibicc)        \n- [ucc](https://github.com/sheisc/ucc162.3)   \n\n[1]: https://space.bilibili.com/181099947","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiiicp%2Flcc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiiicp%2Flcc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiiicp%2Flcc/lists"}