项目作者: tmijieux

项目描述 :
a basic c compiler
高级语言: C
项目地址: git://github.com/tmijieux/bcc.git
创建时间: 2015-12-15T19:51:29Z
项目社区:https://github.com/tmijieux/bcc

开源协议:Apache License 2.0

下载


bcc

a basic c compiler

dependencies

how to compile

  1. mkdir -p build
  2. cd build
  3. cmake ..
  4. make

how to use

./cc1 < input_file.c

OR
use the compile script instead:

  1. ./compile file1.c file2.c file3.c
  2. # then:
  3. ./a.out

(for now the bcc executable
-which is intended to be a drop-in replacement for gcc-
is not working yet)

it uses

  • cpp (c preprocessor) (processes macro/defines/includes )
  • cc1 (c compiler in this project) (transform C to llvm )
  • opt (llvm optimizer) (llvm -> llvm )
  • llc (llvm compiler) (llvm -> machine assembler (text format) )
  • gcc executable (use as a driver for GNU “as”(GNU assembler) and GNU “ld” (the GNU linker))

gcc is invoked on assembler (“.S”) files only and transforms assembler to binary
and eventually link everything together and add the C standard library as well
with all required stuff to call main when program starts … :) !!!

state of the project:

UNFINISHED ! (there is a lot of things that does not work)

credits

The Lex and Yaxx grammars this compiler is based on came from here: