Skip to content

Latest commit

 

History

History
63 lines (47 loc) · 1011 Bytes

README.md

File metadata and controls

63 lines (47 loc) · 1011 Bytes

Book

Contents

  1. lex & yacc
  2. lex

Clone the Source Code

git clone https://resources.oreilly.com/examples/9781565920002.git
mv 9781565920002 lexyacc
cd lexyacc

Build a File

flex ch1-01.l
mv lex.yy.c ch1-01.c
gcc -g -o ch1-01.pgm ch1-01.c -lfl -ll

Run the File

./ch1-01.pgm

hello
hello
bye
bye
^D

Build the Project

Change -ly -ll to -lfl -ll in the Makefile:

# make and run all the example programs for lex & yacc, Second Edition
CC = gcc -g
# LIBS = -ly -ll
LIBS = -lfl -ll
LEX = flex
YACC = yacc
CFLAGS = -DYYDEBUG=1

Build:

make