12.01.2013 Views

Tutorial Lex/Yacc - capsl

Tutorial Lex/Yacc - capsl

Tutorial Lex/Yacc - capsl

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Flex .l specification file<br />

/*** Definition section ***/<br />

%{<br />

/* C code to be copied verbatim */<br />

%}<br />

/* This tells flex to read only one input file */<br />

%option noyywrap<br />

%%<br />

/*** Rules section ***/<br />

/* [0-9]+ matches a string of one or more digits */<br />

[0-9]+ {<br />

/* yytext is a string containing the matched text. */<br />

printf("Saw an integer: %s\n", yytext);<br />

}<br />

.|\n { /* Ignore all other characters. */ }<br />

%%<br />

/*** C Code section ***/<br />

2/17/2012<br />

CAPSL<br />

15

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!