Skip to content

mtexier/ucc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

It should be fairly obvious what this program does

It doesn't use system include files nor libraries yet, just some simple ones in lib/


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

nasm (I have version 2.09.10, not sure what the lowest required is)
ld (any form should be fine)

Obviously you need a compiler to compiler this compiler with.


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

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


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

Pretty much the standard args, cc is found in src/
All paths in cc are relative to this, so don't change it.
I haven't made an install make target yet.

All programs compiled by ucc are staticly linked.


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

nested struct support (parsing works, no code generation)
unions
floating point numbers
long + short types


Examples
========

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

./src/cc -o- -S test.c
- output assmebly code for test.c

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

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

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

./src/cc -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

./src/cc -E -o- test.c
- if you need to ask then read some proper compiler documentation

About

A simple C compiler

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published