Coder Social home page Coder Social logo

fxfactorial / aqcc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ushitora-anqou/aqcc

0.0 2.0 0.0 555 KB

Yet another tiny tiny self-hosted C compiler, assembler, linker and standard C library.

License: MIT License

Makefile 0.88% Shell 0.92% C 93.28% Assembly 0.33% C++ 4.59%

aqcc's Introduction

AnQou C Compiler: aqcc

aqcc is yet another tiny self-hosted C compiler with an also tiny assembler, linker and standard C library.

To Build

Just make.

Usage

./aqcc [options] file...

options are:

  • -S: output an assembly file.
  • -c: output an object file.
  • -o: set the output file name.

To find the detail, try make selfself_test, which tells you all the things.

Note

  • aqcc is a product of Security Camp 2018. Special thanks to @rui314 san and @hikalium san.
  • Many features, functions and so on have not yet been implemented in aqcc that a C compiler generally has. Feel free to implement missing features and to send pull requests :)

AnQou C Compiler の使い方

aqcc をビルド

make としてください。生成物を削除したいときは、 make clean などとしてください。

aqcc の挙動をテスト

  • make test
    • 第一世代(gccなどによりコンパイルされたaqcc)をテスト
  • make self_test
    • 第二世代(第一世代によりコンパイルされたaqcc)をテスト
  • make selfself_test
    • 第三世代(第二世代によりコンパイルされたaqcc)をテスト
    • 第二世代と第三世代に違いがないことも確認されます。

一般のCファイルをコンパイル

./aqcc [options] file...

options には以下のようなものを使用できます。

  • -S アセンブリファイルを出力します。
  • -c オブジェクトファイルを出力します。
  • -o out 出力ファイル名を指定できます。

program.c を以下のようにしてコンパイルし、実行できます。 aqccprogram.c などは適宜読みかえてください。

$ ./aqcc program.c -o program
$ ./program

なお、#include <stdio.h> などとはできません。 program.c の中にこのような構文が含まれている場合は、取り除いて下さい。 その代わりに、自前で puts() 関数などの プロトタイプ宣言を program.c の冒頭に加えてください。 なお、カレントディレクトリ内のファイルはインクルードできますので、 #include "aqcc.h" などとインクルードして、 aqcc.h に記されているプロトタイプ宣言を流用できます。

また、標準ライブラリのうち提供されている機能はごく僅かです。 stdlib.c などを参照して下さい。aqccが自動でこれらをリンクすることはありません。明示的に指定してください。

謝辞

aqccはセキュリティキャンプ全国大会2018の成果物です。 講師の@rui314さんと@hikaliumさんに深く感謝申し上げます。

資料

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.