Giter VIP home page Giter VIP logo

hanando-fukui's Introduction

hanando-fukui

Self-hostable C(+something) Compiler Prototype: Version 3.1.5 (2020/01/04)

Japanese README is avaliable on README.ja.md

How to install

By just typing $ make will compile as ./hanando.

Then, you can use hanando and output assembly to standard output.

$ ./hanando "int main() {printf(\"Hello World!\");}"

Using escaping of quotation is needed to run inside bash.

Alternatively, you can specify and compile a C file.

$ ./hanando -f bar.c

After outputting of assembly, you can compile to an executable with gcc or clang:

$ ./hanando -f bar.c > bar.s
$ gcc bar.s -o bar
$ ./bar

How to compile self-recursively

$ make selftest

hanando-fukui's People

Contributors

hiromi-mi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

itsshadowl

hanando-fukui's Issues

garbage in malloc

in function read_tokenize()
char *buf = malloc(sizeof(char) * (length + 5));
Alloc some garbage at end - why +5 here?

must zero init, before reading;

char *buf = malloc(sizeof(char) * (length + 5));
for (int i=0;i<(length + 5);i++) *(buf+i) = 0;
fread(buf, length + 5, sizeof(char), fp);

Maybe other places, where it is happend.

Implement Inline Function Expansion

インライン関数展開を (再)実装

チェックシート

  • 引数 → Env を掘る
  • Local 変数 → Env を掘る
  • テンプレート関数 -> Optimization Stage なので考慮の必要なし

インライン関数展開の条件

  1. 必須: 再帰呼び出しがなされていない
  2. 高速化のため: 3行以下

引数が const のみな場合は複製せずに済み簡易に処理できるが、全体をさきに実装するか?

実装方針

  • Env をその領域で追加. 元々の関数Env 内で必要な Env を追加する

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.