3 ms·
This reminds me, is there any C compilers that allows injecting custom parsing rules? Say, if it is parsing or type checking and hits upon an error, it calls a
by HexDecOctBin 2y ago
This reminds me, is there any C compilers that allows injecting custom parsing rules? Say, if it is parsing or type checking and hits upon an error, it calls a callback instead of bailing. This would be very useful for adding simple extensions to the language. I tried to make LLVM do this but couldn't figure it out.
- tester756 2y agoIt seems like you're interested in frontend - Clang, not backend - LLVM.
- Gibbon1 2y agoI saw someones tool that allows you to embed python code to generate C code. https://nedbatchelder.com/code/cog/ https://nedbatchelder.com/code/cog/ Never used it.
- fuhsnn 2y agoIf you are ok with unoptimized codegen, chibicc[0] is very easy to modify. For an example checkout the patch set for adding defer in my fork[1]. [0] https://github.com/rui314/chibicc https://github.com/rui314/chibicc [1] https://github.com/fuhsnn/slimcc-defer/commits https://github.com/fuhsnn/slimcc-defer/commits
- metadat 2y agochibicc looks impressive, want to compliment on the clear and concise README. Thank you!