Boost.Variant、Boost.Spirit.Qi、Boost.Spirit.Phoenixを使って簡単な中置記法の計算するための抽象構文木(AST)を作って、そのASTをllvm言語に変換するというのを作ってみました。コード書き殴り。 BoostでASTが割とすっきりと書け、そこからllvm言語に変換することも割と簡単に出来ます。 コードと出力結果はGistのほうに置いておきます。 コード https://gist.github.com/LNSEAB/5335399 出力結果 https://gist.github.com/LNSEAB/5335412 雑ですが説明。 ASTの表現 Boost.VariantでASTを表します。 namespace ast { struct add; struct sub; struct mul; struct div; template <cl