DangerMouseB / minc

A minimal C compiler with a QBE backend (based on minic)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

minc

A minimal C compiler with a QBE backend (based on minic by Quentin Carbonneaux)

goals:

  • learn QBE IR to use in bones
  • learn C-ABI (including C++ exception handling)
  • learn GAS
  • develop components for bones type system, bones vm and a Python in memory compiler (the most basic form of JIT),
    • code generation
    • memory management
    • type system
    • multidispatch
    • exception handling
    • debugging

next:

  • sort extension and promotion
  • clean code gen
  • add intersections and api
  • add nominals and move fully to bones types
  • add <: .... > to lexer and output a TYPE
  • type-lang parser (use miniyacc)
  • get ... working, e.g. //void PP(char *msg, ...) { // va_list args; // va_start(args, msg); // vfprintf(stderr, msg, args); // fprintf(stderr, "\n"); // va_end(args); //}

references:
https://c9x.me/compile/
https://c9x.me/articles/gthreads/intro.html
https://github.com/DoctorWkt/acwj
https://docs.python.org/3/library/ctypes.html
https://developers.redhat.com/blog/2021/04/27/the-mir-c-interpreter-and-just-in-time-jit-compiler
https://git.sr.ht/~mcf/cproc
https://github.com/michaelforney/cproc

https://www.lysator.liu.se/c/ANSI-C-grammar-y.html

YACC - https://arcb.csc.ncsu.edu/~mueller/codeopt/codeopt00/y_man.pdf
https://silcnitc.github.io/yacc.html#:~:text=2.1%20Declarations&text=The%20C%20Declarations%20are%20delimited,section%20into%20the%20generated%20y.
https://github.com/ibara/yacc

https://github.com/ShamithaUdupa/Simple-C-Compiler

https://cdecl.org/

About

A minimal C compiler with a QBE backend (based on minic)

License:Apache License 2.0


Languages

Language:C 32.9%Language:Yacc 24.3%Language:q 22.3%Language:LLVM 16.3%Language:Lex 3.6%Language:Shell 0.4%Language:Makefile 0.1%Language:CMake 0.0%