C0C : 將 C0 程式轉為 CPU0 組合語言的編譯器

程式作品

C 語言

Java

C#

JavaScript

常用函數

文字處理

遊戲程式

衛星定位

系統程式

資料結構

網路程式

自然語言

人工智慧

機率統計

資訊安全

等待完成

訊息

相關網站

參考文獻

最新修改

簡體版

English

檔案:compiler.h

#ifndef COMPILER_H

#include "Parser.h"
#include "Generator.h"

void compile(char *cFile, char *asmFile);

#endif

檔案:compiler.c

#include "Parser.h"
#include "Generator.h"

void compile(char *cFile, char *asmFile) {     // 編譯器主程式
  printf("compile file:%s\n", cFile, asmFile);
  char *cText = newFileStr(cFile);             //   讀取檔案到 cText 字串中。
  Parser *parser = parse(cText);               //   剖析程式 (cText) 轉為語法樹
  generate(parser->tree, asmFile);             //   程式碼產生
  ParserFree(parser);                          //   釋放記憶體
  freeMemory(cText);
}

Facebook

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License