Skip to content

CkTD/mycc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mycc

A toy c compiler for learning purpose, support some C99 features and generate code for x86_64.

References

C

x86

Concept

Some Implements

Others

TODO

  • 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
  • Conversions
    • floating types
  • Lexical elements
    • constant
      • integral constant
        • decimal
        • octal / hex
        • suffix
      • floating constant
      • character constant
      • string literials
        • simple escape
        • octal/hex escape
    • comments
  • Statements
    • switch statement
    • goto statement
  • Expressions
    • operand constrains: null pointer? type qualifer? type compatible?
    • sizeof type-name
    • struct/union related operator
    • cast operator
  • Declarations
  • 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

About

a toy c compiler

Resources

Stars

Watchers

Forks

Releases

No releases published