The Lex Source Code

Note that a "\" was added to HTML tags in the source below so that they would show up in a web browser.

W			[ \t\n]
%%
"<"{W}*A{W}*HREF.*">"	printf ("%s\n<\p>", yytext);
"<\HTML>"		;	/* avoid printing twice--see main() */
"<\/HTML>"		;	/* avoid printing twice--see main() */
.			;	/* do nothing */
\n			;  
%%
#include 

main() {
	int returnValue;
	
	printf ("<\HTML>\n");
	returnValue=yylex();
	printf ("\n");

	return (returnValue);
}

The Makefile


prog1: lex.yy.c
	cc lex.yy.c -ll -o prog1

lex.yy.c: foo.l
	lex foo.l