|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
C compiler front end wanted
I'm working on a C based tool that needs to operate of a full C AST
basically, it can be thought of as a code generator for a really twisted CPU architecture. Does anyone know if there are any clean, standalone libraries for parsing, verifying and then generating full ASTs, from C source code? So far, my research has shown up a few tools like ctool, which generates annotated parse trees but don't do full type analysis and program verification; things like elsa, which is really designed for C++ and as such is grotesquely overcomplicated for what I want (and also, I can't make it build); and compiler frontends that are actually attached to compilers, such as pcc, sdcc, ack, gcc etc, which are unfortunately so tightly integrated to the compiler backend that ripping out the existing backend and replacing it with mine is a huge amount of work. I'm sure there *must* be something like this out there, somewhere. Can anyone suggest anything I should have a look at? ( source, please!) [Don't hold your breath waiting for free tools here. Sometimes you only get what you pay for. -John] |
|
#2
|
|||
|
|||
|
C compiler front end wanted
David Given wrote:
I'm working on a C based tool that needs to operate of a full C AST [snip] So far, my research has shown up a few tools like ctool, which generates annotated parse trees but don't do full type analysis and program verification; things like elsa, which is really designed for C++ and as such is grotesquely overcomplicated for what I want (and also, I can't make it build); [snip] You may want to take another look at Elsa. I've been successful using Elsa as a C front end for LLVM. I can compile most of C (e.g. bzip2, etc.) to a running program after a couple of weeks of work. What sort of problems have you encountered building Elsa? It compiled cleanly for me an my Linux box. -Rich |
|
#3
|
|||
|
|||
|
C compiler front end wanted
David Given schrieb:
I'm working on a C based tool that needs to operate of a full C AST basically, it can be thought of as a code generator for a really twisted CPU architecture. > Does anyone know if there are any clean, standalone libraries for parsing, verifying and then generating full ASTs, from C source code? I only have ToPas, a C parser written in Delphi. If you are interested, have a look at SourceForge. Support for an AST could be added Another chance: TextTransformer. Ask the author for his C++ parser, used in an C++ to Java translator. TextTransformer can (be made to) create an AST, and also can produce C++ code for the parser, in the prof version. DoDi |
|
#4
|
|||
|
|||
|
C compiler front end wanted
David Given wrote:
[] Does anyone know if there are any clean, standalone libraries for parsing, verifying and then generating full ASTs, from C source code? Thanks for all the replies; currently, sparse seems to be looking good it even decomposes the expression trees into pseudo-code using virtual registers in SSA form with liveness tracking, which means that all I need to do is to bolt a noddy register allocator on the top and I'm pretty much good to go. Very convenient. However, it *is* all under construction and is totally undocumented, which means I've got no idea if there are any gotchas coming up: but if so, I've got plenty of other tools to look at. Thanks! |
![]() |
| Viewing: Web Development Archives > FAQs > Compilers > C compiler front end wanted |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|