|
|
(30 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| == Basic Concepts ==
| | #REDIRECT [[ist:The Flex Lexical Analyzer]] |
| | |
| * Definitions
| |
| * Rules, actions
| |
| * Code
| |
| * States and sub-automata
| |
| | |
| == Structure of a Flex Specification ==
| |
| | |
| == How to Debug a Flex Specification ==
| |
| | |
| There are various flags and variables to activate the debug functionality in Flex (there is no need to insert useless code such as printfs or similar).
| |
| | |
| The debug option will activate code for debugging as will the call to the <tt>set_debug</tt> method (see the scanner header file in Compact for an example).
| |
| | |
| In the CompactScanner.l file:
| |
| %option debug
| |
| | |
| In the CompactScanner.h file (in the constructor):
| |
| set_debug(1);
| |
| | |
| Also, the YYDEBUG environment variable will activate the debug messages '''both''' in Flex and YACC (allowing debug of token recognition by the scanner and use by the parser).
| |
| | |
| == Examples ==
| |
| | |
| * [[Extracting HREF attributes from HTML files]]
| |
| | |
| [[category:Compilers]] | |
| [[category:Teaching]]
| |