ZCC
ZJU standard C Compiler
Install / Use
/learn @hlFu/ZCCREADME
ZCC
ZJU standard C Compiler
<!-- ##免责声明 我看大家都没动手,为了美好的明天,必须出来打个底 如果大家觉得定的有什么不对的地方,欢迎修改!!! ## 项目分布 请将: lex和yac放在yyparse文件夹 symbol table和类型检查放在symbol 机器码生成放在generation 全局变量放在public 优化代码放在各自部分的文件夹下 -->Code Organization
- Lex and Yas related codes are in the folder yyparse.
- Symbol table and Type check related codes are in the folder symbol.
- Generating machine code related codes are in the folder generation.
- Treating Special variables related codes are in the folder public.
- Optimization codes are stored separately in each folder.
Parsing Tree Sample:
declaration
declaration_specifiers
storage_class_specifier
typedef
declaration_specifiers
type_specifier
struct_or_union_specifier
struct_or_union
struct
{
struct_declaration_list
struct_declaration_list
struct_declaration
specifier_qualifier_list
type_specifier
int
struct_declarator_list
struct_declarator
declarator
direct_declarator
a
;
struct_declaration
specifier_qualifier_list
type_specifier
double
struct_declarator_list
struct_declarator
declarator
direct_declarator
c
;
}
init_declarator_list
init_declarator
declarator
direct_declarator
mytype
;
Code Generation
Miscellaneous
<!--用来解析树和调用self.tools中的函数进行翻译 -->Call functions in self.tools to translate.
Detailed comments and examples can be found in generation.generate.
Basic X86 supports
- Calculation: add, sub, mul, div.
- Logic: and, or, not.
- Jump: jmp, je, jg, jl.
- Shift: sal, sar.
- Function: call, ret.
- Stack: push, pop.
- Float number operation: fld, fstp, fadd, fsub, fmul, fdiv.
- Global/Static variables, Constant float number, String
Code Optimization
The optimization types supported
http://www.compileroptimizations.com/index.html
Constant propagation
http://people.eecs.berkeley.edu/~bodik/cs264/lectures/4-chaotic-notes.pdf
Related Skills
node-connect
345.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
104.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
