C ライクなコンパイラを開発していますが、コンパイラがシステム インクルードでどのように動作するかを知りたいです。
コンパイラはコード全体を読み取り、現在のコードの読み取りが終了した後、1 つのリストにあるすべてのインクルードを格納し、インクルードをパーサーしますか?
// file main.c
#include <stdio.h> // store in one list
// continue the parse ...
int main()
{
return 0;
}
// now, read the includes
// after finish the includes parse, gen code of sources
// just a sample
// file stdio.h
#include <types.h> // store in list
#include <bios.h> // store in list
void printf(...)
{
}
void scanf(...)
{
}
ところで、インクルードを読み取り、解析を停止してインクルードを読み取るシステム (テストのみ) を開発しました... (これは嫌なコードですが、機能します...) (サンプルのリンク) -> https: //gist.github.com/4399601
ところで、インクルードを読んでインクルードファイルを操作する最良の方法は何ですか??