{"id":15048877,"url":"https://github.com/occisor2/clc","last_synced_at":"2025-12-29T12:21:38.810Z","repository":{"id":253194604,"uuid":"819017000","full_name":"occisor2/clc","owner":"occisor2","description":"A small C compiler in Common Lisp","archived":false,"fork":false,"pushed_at":"2024-08-29T23:26:48.000Z","size":59,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-20T19:14:20.732Z","etag":null,"topics":["c-language","c-programming","c-programming-language","common-lisp","compiler","compilers","programming-language","programming-languages"],"latest_commit_sha":null,"homepage":"","language":"Common Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/occisor2.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-06-23T14:39:40.000Z","updated_at":"2025-01-06T21:01:32.000Z","dependencies_parsed_at":"2024-08-15T04:43:58.323Z","dependency_job_id":"b626c414-fc8e-42cb-92ef-b3a99c76571b","html_url":"https://github.com/occisor2/clc","commit_stats":null,"previous_names":["occisor2/clc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/occisor2%2Fclc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/occisor2%2Fclc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/occisor2%2Fclc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/occisor2%2Fclc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/occisor2","download_url":"https://codeload.github.com/occisor2/clc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243500771,"owners_count":20300770,"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-language","c-programming","c-programming-language","common-lisp","compiler","compilers","programming-language","programming-languages"],"created_at":"2024-09-24T21:16:57.982Z","updated_at":"2025-12-29T12:21:38.787Z","avatar_url":"https://github.com/occisor2.png","language":"Common Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"#+TITLE:     CLC Compiler\n#+AUTHOR:    Russell Smith\n#+EMAIL:     russell.smith7502@gmail.com\n#+DESCRIPTION: A small C compiler written in Common Lisp \n#+KEYWORDS:  C, Compiler, Lisp\n#+LANGUAGE:  en\n#+OPTIONS:   H:4 num:nil toc:2 p:t\n\n* Summary\n\n** Current Features\n\n- Variables: No intialization at all; no global variables; can be\n  defined anywhere in the function\n- Types: Only int supported right now\n- Functions: No multiple or separate definitions from implementation;\n  only 6 or less arguments in calls; only int return type, no void;\n  since no declaring functions, you can't link against other libraries\n  yet\n- Operators: Currently supported: +, -, *\n- Control Flow: If statements with optional else; if and else must\n  have a compound statement following them\n- Error Handling: Syntax and other errors generate Common Lisp\n  conditions as of now, so are not very user friendly\n  \nThe entire compilation pipeline is implemented, so all these features\ncompile to assembly code. The compiler is really just a fancy\ncalculator with basic control flow right now. You can get program\noutput by returning values from main. No runtime has been implemented\nyet, so you need to link against gcc or clang's.\n\n* About\n\nI've been trying to write a C compiler for about a year, but either\ngot busy or stuck with a design issue. I've finally got something\nworking though small with this project and have big goals for the\nfuture.\n\n** Why Lisp?\n\nI've always found Lisp really interesting, especially Common Lisp. The\nREPL oriented development style of Lisp also made trying new things\nduring development a lot easier compared to C++, which is what I was\nusing.\n\n** Future Goals\n\n- Implement a much larger subset of the language\n- Improve the diagnostic messages\n- Add optimization passes after the IR generation stage, specifically\n  constant propogation, mem2reg, and dead code elimination.\n- Implement my own crt0 and small LibC\n\n** Resources\n\nFor the frontend, I learned most of what I know about and lexing and\nparsing, specifically Pratt Parsing, from Robert Nystrom's /Crafting\nInterpreters/. My AST and symbol handling design is some of my own,\nprobaly not very original, and based on other various sources. My IR\nis very inspired by LLVM without the SSA format, and a large portion\nof my assembly code generator is based on the methods described in\nNora Sandler's /Writing a C Compiler/. I learned most of the weird\nlanguage semantics related to C from Nora's book too.\n\n\n* Automatic Installation\n\nClone the repository into ~/quicklisp/local-projects then load and\ninstall dependencies via quicklisp.\n\n#+BEGIN_SRC lisp\n  (ql:quickload 'clc)\n#+END_SRC\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foccisor2%2Fclc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foccisor2%2Fclc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foccisor2%2Fclc/lists"}