I am working on a project where I have to define a new processor hardware architecture. I need a compiler to generate assembly code for this target (it has its own instruction set).
Programs for this processor will be written in C.
My idea to do this is to parse the C code and generate an Abstract Syntax Tree (AST), then from the AST generate the assembly.
Certainly I'd like to reuse existing components (no need to rewrite a C parser I hope), but what tools or frameworks may I use to accomplish this task?
Thanks.
Take a look at LLVM.
It consists of seperate modules which can be created individually and communicate through an intermediate language. In you're case you'll have to write the assembly back-end and reuse other people's C compiler.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With