by an1sotropy · 4y ago · 0 comments
I should spend some more time reading through what you have, but can you answer: what parts of this should I be looking at if I just want something to generate an AST for C99 (no transpiling needed)?
There’s some source analysis I’d like to do (on student C code) and right now I’m considering the (python-based) C parser in CFFI, but your’s might be more complete?
You can use it as reference to create different "visits". For instance, I am implementing a code format at "visitformat.c".
I have implemented a "naming convention checker" inside the parser, but it also can be a "visit".
Static analysis etc..can be a visit.
Inside the visit context you will find
struct ast ast;
That is the AST.
I would say the syntactic analysis parser is 100% complete C23.
Semantic analysis that is not 100%.
As long as we’re on this tangent, here’s the challenge I’m facing with automated analysis of student code: from foo.c make bar.c which is identical to foo.c except that comments have been turned into spaces. I think this is annoyingly non-trivial.