flex

来源:互联网 发布:telnet端口23在哪 编辑:程序博客网 时间:2024/06/03 14:52

linux下的flex全称叫做  快速词汇分析程序生成器
(很可惜,百度上费尽周折没有搜到想要的关于Flex的有用信息,不过搜Lex还是有点结果的,一下信息搜自google)
http://flex.sourceforge.net/

Flex

Flex (The Fast Lexical Analyzer)

Flex is a fast lexical analyser generator. It is a tool for generating programs that perform pattern-matching on text. Flex is a free (but non-GNU) implementation of the original Unix lex program. To download the software, get the documentation, and more, please see the Flex home page.

Overview of Flex

Flex is a tool for generating scanners. A scanner, sometimes called a tokenizer, is a program which recognizes lexical patterns in text. The flex program reads user-specified input files, or its standard input if no file names are given, for a description of a scanner to generate. The description is in the form of pairs of regular expressions and C code, called rules. Flex generates a C source file named, "lex.yy.c", which defines the function yylex(). The file "lex.yy.c" can be compiled and linked to produce an executable. When the executable is run, it analyzes its input for occurrences of text matching the regular expressions for each rule. Whenever it finds a match, it executes the corresponding C code.

(Flex是有详细的manual文档的,尽情的搜吧)

1

linux ubuntu 12.04 安装flex

sudo apt-get install flex

2

Terminal解释

wayne@ubuntu:~/Downloads/lxr-1.2.0$ flex --help
Usage: flex [OPTIONS] [FILE]...
Generates programs that perform pattern-matching on text.



原创粉丝点击