Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
lexyacc

lexyacc

Ratings: (0)|Views: 62|Likes:
Published by jain
LEARN THE LEX & YAAC
LEARN THE LEX & YAAC

More info:

Categories:Topics, Art & Design
Published by: jain on Feb 12, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF or read online from Scribd
See more
See less

06/30/2009

 
 
A
 
C
OMPACT
G
UIDE TO
 L
EX
&
 
Y
ACC
 
by Tom Niemann
epaperpress.com
 
 
Contents
2
 
 Preface
This document explains how to construct a compiler using lex and yacc. Lex and yacc are toolsused to generate lexical analyzers and parsers. I assume you can program in C, and understanddata structures such as linked-lists and trees.The introduction describes the basic building blocks of a compiler and explains the interactionbetween lex and yacc. The next two sections describe lex and yacc in more detail. With thisbackground we can construct a sophisticated calculator. Conventional arithmetic operations andcontrol statements, such as
if-else
and
while
, are implemented. With minor changes we willconvert the calculator into a compiler for a stack-based machine. The remaining sections discussissues that commonly arise in compiler writing. Source code for examples may be downloadedfrom the web site listed below.Permission to reproduce portions of this document is given provided the web site listed below isreferenced, and no additional restrictions apply. Source code, when part of a software project,may be used freely without reference to the author.Tom NiemannPortland, Oregonweb site:epaperpress.com3

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->