Skip to content

doniexun/ucc-c-compiler

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

It's a compiler!

Partial support for system include files - barring a preprocessor bug.
System libraries are fully supported, including ABI compatability with things like va_list.


Requirements
========================

as (I use gnu as, but any should be fine)
ld (any form should be fine)

Obviously you need a compiler to compile this compiler with.


Compiling (the compiler)
========================

./configure [--as=path/to/as]
make


Compiling C files
=================

Pretty much the standard arguments.
I haven't made an install make target yet, ucc finds libraries + includes locally

All programs compiled by ucc are statically linked.


Major C-Features Todo
=============

C99 VLAs (experimental/vla)
By-value argument passing and function return for:
	- structure/union types (feature/1st-class-structs)
	- long-double types
	- long long types on 32-bit archs


Examples
========

./ucc -o hello hello.c
- preprocess, compile, assemble and link hello.c into hello

./ucc -o- -S test.c
- output assembly code for test.c

./ucc -o- -S -Xprint test.c
- show the abstract parse tree with type annotation and stack offsets, etc

./ucc -c test.c
- (preprocess) compile and assemble test.c -> test.o

./ucc -c test.s
- assemble test.s -> test.o
(preprocessing and compilation are skipped)

./ucc -fenglish -Xprint -o- test.c
- (-fenglish) show the abstract parse tree with output decls in english
e.g.:
	int *(*const (*x)(void))(int);
becomes:
	"x": pointer to function(taking no arguments) returning const pointer to function(int) returning pointer to int

./ucc test.c a.o -o out b.a
- preprocess + compile test.c, and link with a.o and b.a to form the executable out

./ucc a.o b.c -E
- preprocess b.c - a.o is ignored since it's not linked with

About

A simple C compiler - check the experimental branch(es)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published