A toy c compiler for learning purpose, support some C99 features and generate code for x86_64.
- C99 Gramer
- C standards
- C99 html pdf
- C operator precedence
- Understand integer conversion rules(Integer Promotions, Integer Conversion Rank, Usual Arithmetic Conversions), C99(6.3)
- Implicity prototype C99 vs C90
- alignment
- Guide to x86-64
- x86 and amd64 instruction reference
- gas manual
- x86_64-abi (3.2 Function Calling Sequence)
- call printf in x86_64 using gas
- RPI relative addressing
- Computer Systems A Programmers Perspective (3rd)
- Compiler
- Compilers Principles, Techniques, and Tools (2rd)
- Recursive descent parser
- LL parser
- Scope wiki C
- Types
- integrial types
- char
- shrot
- int
- long
- long long
- floaing types
- pointer types
- enumeration types
- function types
- returing struct/union or taking sruct/union as paramenter
- array types
- variable length array type
- struct types
- union types
- type alignment
- integrial types
- Conversions
- floating types
- Lexical elements
- constant
- integral constant
- decimal
- octal / hex
- suffix
- floating constant
- character constant
- string literials
- simple escape
- octal/hex escape
- integral constant
- comments
- constant
- Statements
- switch statement
- goto statement
- Expressions
- operand constrains: null pointer? type qualifer? type compatible?
- sizeof type-name
- struct/union related operator
- cast operator
- Declarations
- typedef
- initialization
- declaration of function without name
- struct/union with bit-field member
- struct/union with flexible array member
- Preprocessing
- Others
- remove print statement by calling library function "printf"
- for test, compile the source code with gcc, use the output of gcc as target output
- for debug: add corrsponding source line in output file
- add source location in error message
- associate related Token to Node and Type
- distinguish identifiers referencing to the same var (we can error at current identifier that reference the var, instead of where the var declared)
- error recovery, (test/085.c)
- read srouce code from file, write output to file