|
|
|
|
lex for Not Yet Techies"Computer Careers: Using This Unix Software Tool to Help You Create Applications"by Richard Stooker, President Info Ring Press and author of Secrets of Changing to a Computer Career |
|
lex is a Unix software tool, often used in conjunction with yacc and compiler writing, that generates programs for simple lexical tasks. Yet lex may be used as a standalone utility generating code automatically and more reliably than a programmer might do. lex source files are short and easier to read than the equivalent C code and thus produce more maintainable products. It is very similar to awk, so we can sometimes replace awk-based solutions which normally involve shell scripts and multiple tools with a single based process. Because lex has strong similarities to awk and uses the common syntax of 'regular expressions' and 'C' it is easy to learnIt is a compiler writing tool and is also well suited to scanning an input stream of characters for transformation or analysis. Like awk, a source file of patterns and their associated actions is provided as an input script. Each time a pattern (using regular expressions and literals) maps to the input data it triggers an action(s). Unlike awk it does not perform the action immediately but instead generates a C source file containing a C function called yylex(). 3 reasons programmers do not use lex:
Yet it can be used to implement even simple programs more quickly than a conventional programming language. A script is usually much more readable than a conventional programming language. lex is easy to learn, especially if one is familiar with the syntax of C and regular expressions. Next: mod_perl |
|
Use Your New Computer Career as a Stepping Stone to Even Greater SuccessSend off for your free 7-part Techie Plus eCourse now. So that you can learn:
It's fast and easy. You will receive the first part in your email box within minutes. I respect your privacy. I will never sell, rent or trade your email address. After you subscribe, the form will redirect you to a thank you page. Thank you! Rick Stooker |
|
Permission is granted to reprint the above article in an ezine or on a website as long as it is reprinted in full, with no changes, with full credit and with this contact information and link included at the bottom. All other rights reserved. Copyright 2007 by Info Ring Press All Rights Reserved. Computer Careers (Home) Sitemap Contact Privacy Info Ring Press Richard Stooker PO Box 617 130-G Ballwin Manor Dr Ballwin, MO 63011 (636) 394-2052 rick@inforingpress.com |