Skip to content

seven-mile/CKaleidoscope

Repository files navigation

CKaleidoscope

It's required that the type system be reconstructed in order to fit the need of adding pointer types and array types.

If you have some good ideas on that, please don't hesitate to create an issue.

LLVM tutorial

Advanced tutorial

Todo

  • Lexer with any token & debug outputing
  • Basic AST definition & types
  • Basic parser
  • Type extension (only double for all numbers)
  • Variable & Assignment
  • Braced code block
  • String type
  • Constants: string, char
  • Stdlib support: std IO, file IO (directly using C-API)
  • If statement
  • For statement
  • Switch statement
  • Return statement
  • Pointers (such as &,* operator)
  • Full number types
  • Array type -> Compound array & pointer (even reference) type parsing
  • Implement a segment tree
  • Comma operator
  • Source Location
  • sizeof,alignof operator
  • Ternary operator
  • Function (pointer) type
  • DWARF support ☆ Source-level debug
  • Compile into executable file
  • Label and goto [low prior]
  • Structure / class

  • Maybe: a VSCode extension for the toy language... (highlighting, language-server)

Known Issues

  • segfault when data is too large (nothing to do with JIT)
  • for llvm-12, JIT will crash when looking up symbol main
  • (Dev) CMake Debug lost Path information, which leads to linking error

Examples

Please check the test directory.