sysprog21/shecc

For a coding question: about parser

ChenMiaoi opened this issue · 3 comments

I would like to ask, in parser, is "shecc" a directly generated instruction set linked list sequence? I don't seem to have found the relevant code for AST. If so, please point out.

If possible, may you comment on each structure and field in def.h?

Heartfelt thanks.

Is "shecc" a directly generated instruction set linked list sequence?

No, check src/main.c for brief compilation flow. The shecc initially loads and interprets the provided C source file, transforming it into an initial phase of intermediate representation (IR). This IR is then structured into Static Single Assignment (SSA) form, paving the way for enhanced optimizations. Following this, the SSA-based optimizations contribute to the creation of a second-phase IR, which serves as the groundwork for the eventual generation of machine code.

If possible, may you comment on each structure and field in def.h?

I believe it is not necessary to comment on each structure, just as we would not expect LLVM developers to comment on every function. Could you specify which ones you would like to discuss in more detail?

By the way, the book Parsing Techniques: A Practical Guide 2/e offers valuable insights into the inner workings of compilers and is a highly recommended resource for those interested in learning more about this topic.

Thanks. I'll read this.