文件名称:Lex和Yacc入门(A COMPACT GUIDE TO Lex&Yacc)含源码
文件大小:126KB
文件格式:RAR
更新时间:2013-03-14 07:05:24
lex yacc compact guide to
该文档主要讲解了如何用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 introduction 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 detail. With this background we can construct a sophisticated calculator. Conventional arithmetic operations and control statements, such as if-else and while, are implemented. With minor changes we will convert the calculator into a compiler for a stack-based machine. The remaining sections discuss issues that commonly arise in compiler writing. Source code for examples may be downloaded from the web site listed below. Permission to reproduce portions of this document is given provided the web site listed below is referenced, and no additional restrictions apply. Source code, when part of a software project, may be used freely without reference to the author.
【文件预览】:
A+Compact+Guide+to+Lex+&+Yacc.pdf
A+Compact+Guide+to+Lex+&+Yacc+(code).zip