タグ

compilerに関するmactkgのブックマーク (4)

  • 低レイヤを知りたい人のための Cコンパイラ作成入門

    はじめに このオンラインブックは執筆中です。完成版ではありません。フィードバックフォーム このには一冊のに盛り込むにはやや欲張りな内容を詰め込みました。書では、C言語で書かれたソースコードをアセンブリ言語に変換するプログラム、つまりCコンパイラを作成します。コンパイラそのものもCを使って開発します。当面の目標はセルフホスト、すなわち自作コンパイラでそれ自身のソースコードをコンパイルできるようにすることです。 このでは、コンパイラの説明の難易度が急に上がりすぎないように、様々なトピックを書全体を通じて次第に掘り下げていくという形で説明することにしました。その理由は次のとおりです。 コンパイラは、構文解析、中間パス、コード生成といった複数のステージに概念的に分割することができます。よくある教科書的アプローチでは、それぞれのトピックについて章を立てて解説を行うことになりますが、そのよう

  • プログラミング言語を作る yaccとlex

    yacc/lexとは Cでプログラミング言語の処理系を実装するのであれば、 多くの場合、yaccとlexというツールを使います。 実のところ、Cとyacc/lexで簡単なプログラミング言語を作る、というのは、 以前、「C言語ヨタ話 」で書いた「 電卓を作ってみよう」 の焼き直しになります。yaccとlexの説明もそちらに簡単に書いたので、 そちらを見てください――と言いたいところですが、 まあここでも軽く説明します。 内容的には重複、というかコピペしている部分もありますが。 プログラミング言語の処理系は、通常、以下のような手順を取ります。 字句解析 ソースプログラムを、「字句(トークン)」の並びに分割する処理です。 構文解析 トークンの並びから、解析木を構築する処理です。 この後、Cなどの機械語を吐くコンパイラや Javaのようなバイトコードを吐くコンパイラなら、 「コード生成」という処理

  • Kazuho's Weblog: Making the HTTP server run 20% faster by using qrintf-gcc; a sprintf-optimizing preprocessor / compiler

    Making the HTTP server run 20% faster by using qrintf-gcc; a sprintf-optimizing preprocessor / compiler tl;dr This is an initial release announcement of qrintf, a preprocessor (and qrintf-gcc is the compiler frontend) that optimizes calls to sprintf and snprintf. C programs calling the functions may run faster by using the preprocessor / compiler in place of the standard compiler toolchain. Backgr

    mactkg
    mactkg 2017/01/12
    “The function takes a format string (e.g. "my name is %s") and parse it at runtime, every time the function gets called.”
  • The Compiler Writer Resource Page

    Resources for Amateur Compiler Writers I know complete pans of the literature are left out, but this is a page for amateur compiler writers. Anything that I did not find practical is not listed here. (I also did not include the things that I do not yet know!) All the remarks in grey and even the selection of documents are personal. If you have suggestions of papers to include, please contact me! F

    The Compiler Writer Resource Page
  • 1