タグ

関連タグで絞り込む (2)

タグの絞り込みを解除

yaccに関するkomlowのブックマーク (2)

  • Lex & Yacc

    This document explains how to construct a compiler using lex and yacc. Lex and yacc are tools used to generate lexical analyzers and parsers. I assume you can program in C and understand data structures such as linked-lists and trees. The Overview describes the basic building blocks of a compiler and explains the interaction between lex and yacc. The next two sections describe lex and yacc in more

    komlow
    komlow 2018/03/20
  • プログラミング言語を作る yaccとlex

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

  • 1