Lexical analysis is an essential part of compilation principles. This part of the experiment generally uses flex and GCC tools. I like protable apps. After reading some documents, I sorted out this Toolkit myself. In fact, this Toolkit only collects and organizes some existing programs, and only has one original BAT file. If the entire toolkit is less than 3 MB, it can be used as long as it is decompressed. Of course, there is not much test done. Release it first and accept feedback. For more information, see the read me.txt file. : Http://files.cnblogs.com/tt-0411/flex_gcc_tools.zip.
The content of the read me.txt file is attached:
Flex + GCC lexical analysis experiment Toolkit
About
This is a simple toolkit for Flex + GCC lexical analysis experiments.
Flex program, from the gnuwin32 project flex for Windows on SourceForge, http://goo.gl/wqynl.
GCC program, blog post from "code first", "GCC compiler under Windows command line", article address: http://goo.gl/vb1ok. The description in this article is that GCC is extracted from Dev-CPP, and the library files may be incomplete.
Start file start. bat, which is created by myself. The function is to add the bin directory of flex and GCC to the system variable path. (This path will only be valid in the current process and will not be added to the actual system variables, and the path setting will not expire when the CMD window exits ).
Sample. l in the test file. The code is from http://goo.gl/xyvme. The usage is slightly different. See the following operations.
Generation:Flex sample. L
After the command is executed, a C code file Lex. yy. C is generated.
Compile:Gcc-G Lex. yy. C-o Sample
An executable file sample.exe is generated after the command is executed, and a warning can be ignored.
Run:Sample
Run the command and wrap the line. Enter any letters or numbers. Press enter to display the type judgment prompt. Press Ctrl + Z to end the input. Type statistics are collected. Then the sample program exits.
Double-click Start. BAT to start the command line, which can be used in the same way as the test file.
This toolkit is only used for learning. All files and programs are copyrighted by the original author.
Welcome to my blog http://www.cnblogs.com/tt-0411