Skip to content

azrsh/azcc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

azcc: AZrsh's C Compiler

x64 Linux CI x64 Cygwin CI license

This is a toy C compiler, developed at seccamp2020.

Enviroment

  • Linux on x86_64 CPU
  • Cygwin on x86_64 CPU

Requirement

  • GNU C Compiler
    • For pre-processing, assembling, linking and running some tests.
  • GNU Make
    • For building and running tests.
  • POSIX like shell
    • For running some test shell scripts.

How to Build and Test

  • make: build 1st generation azcc.
  • make test1: build and run tests for 1st generation azcc, which is built by gcc, clang, or such other C Compiler.
  • make test2: build and run tests for 2nd generation azcc, which is built by 1st generation azcc.
  • make test3: build and run tests for 3rd generation azcc, which is built by 2nd generation azcc.
  • make test-all: build and run tests for all generation azccs.
  • make clean: remove binaries.
  • make all: run make clean and make test-all.

Usage

Basic

Makefile outputs bin/genX/azcc(X is the generation of azcc).
After running make command, you can do the following:

$ cpp source.c > source.i
$ bin/genX/azcc source.i > source.s
$ gcc -o source.out source.s

or

$ cpp source.c | bin/gen1/azcc - | gcc -xassembly -o source.out -

Advanced

You can cross-compile by adding target option.
For example, when you want to compile Cygwin binary on Linux, like the following:

$ cpp source.c > source.i
$ bin/genX/azcc source.i --targt=amd64-w64-windows-gnu > source.s
$ gcc -o source.out source.s

For a complete list of current supported platform, see Enviroment.

Thanks

  • Rui Ueyama, instructor at seccamp2020
  • hikalium, instructor at seccamp2020
  • hsjoihs, tutor at seccamp2020, contributor of this project
  • sksat, tutor at seccamp2020, contributor of this project
  • Takana-Norimasa, classmate at seccamp2020
  • yanorei32, contributor of this project
  • and more classmates at seccamp2020

Reference