https://github.com/thradams/cake Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code + Explore + All features + Documentation + GitHub Skills + Changelog * Solutions + By Size + Enterprise + Teams + Compare all + By Solution + CI/CD & Automation + DevOps + DevSecOps + Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles + Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} thradams / cake Public * Notifications * Fork 8 * Star 197 Cake a C23 front end and transpiler written in C thradams.com/web3/index.html License GPL-3.0 license 197 stars 8 forks Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights thradams/cake This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 1 branch 0 tags Code * Clone HTTPS GitHub CLI [https://github.com/t] Use Git or checkout with SVN using the web URL. [gh repo clone thrada] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @thradams thradams Merge pull request #3 from Skyhero-admin/main ... 6d95342 Sep 13, 2022 Merge pull request #3 from Skyhero-admin/main fix: fixed typo on line 54 readme.md 6d95342 Git stats * 74 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time docs c23 pdf updated Sep 3, 2022 src format update Sep 13, 2022 vc format option Sep 13, 2022 .gitattributes Update .gitattributes Aug 17, 2022 .gitignore embed, warning, _Generic Aug 18, 2022 LICENSE Initial commit Aug 16, 2022 README.md Merge pull request #3 from Skyhero-admin/main Sep 13, 2022 manual.md format option Sep 13, 2022 View code [ ] Description Web Playground Features Build Windows Linux Build web Command line Road map References Influenced by Status? How cake is tested? README.md Description Cake is a C23 compiler front end written from scratch in C. The compiler can be used to translate new versions of C (like C23) to C99. It also can be used to try out new features for the C language. Extensions like lambdas, defer and more were implemented. Web Playground This is the best way to try. http://thradams.com/web3/playground.html Features * C23 preprocessor * Syntax analysis * Semantic analysis * C backend * Builds AST Build Windows Open the Developer Command Prompt of visual studio. Go to the src directoy and type cl build.c && build This will build cake.exe. Linux Got to the src directory and type: gcc build.c -o build && ./build To run unit tests windows/linux add -DTEST for instance: gcc -DTEST build.c -o build && ./build Build web Emscripten https://emscripten.org/ is required. First do the normal build. The normal build also generates a file lib.c that is the amalgameted version of the "core lib". Then at ./src dir type: call emcc -DMOCKFILES "lib.c" -o "Web\cake.js" -s WASM=0 -s EXPORTED_FUNCTIONS="['_CompileText']" -s EXTRA_EXPORTED_RUNTIME_METHODS="['ccall', 'cwrap']" This will generate the cake.js Command line Make sure cake is on your system path. Samples cake source.c this will ouput ./out/source.c See Manual Road map * Complete semantic analisys * Static analysis * Backend, maybe qbe QBE References A copy of each C standard draft in included in docs folder. The parser is based on C23. Influenced by * Typescript * Small C compilers Status? Even if not necessary for most features, I want Cake to make a full semantic analysis. It is necessary more work it is not complete yet. One thing that is missing is check for type compatibility for instance when calling a function void F(int i) with F(1.2); How cake is tested? I am using Visual Studio 2022 IDE to write/debug cake source. Cake is parsing itself using the includes of MSVC and it generates the out dir after build. Cake source code is not using any extension so the output is the same of input. This compilation is usefull for tracking errors. Cake uses unit tests that are called automatically. About Cake a C23 front end and transpiler written in C thradams.com/web3/index.html Topics c front-end compiler transpiler Resources Readme License GPL-3.0 license Stars 197 stars Watchers 5 watching Forks 8 forks Releases No releases published Packages 0 No packages published Contributors 4 * @thradams thradams Thiago Adams * @rurban rurban Reini Urban * @hcmh hcmh Christian Holme * @Skyhero-admin Skyhero-admin Sayed Mohammed Nouman Languages * C 98.5% * Other 1.5% Footer (c) 2022 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.