Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 976 Categories, Downloaded 29.545.120 Times

Flex 2.5.33

  Date Added: October 14, 2010  |  Visits: 1.908

Flex

Report Broken Link
Printer Friendly Version


Product Homepage
Download (173 downloads)



Flex is a Fast Lexical Analyzer. Flex is a fast lexical analyzer generator. It is a tool for generating programs that perform pattern-matching on text. Flex is a non-GNU free implementation of the well known Lex program. Flex is a tool for generating scanners: programs which recognized lexical patterns in text. flex reads the given 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 as output a C source file, `lex.yy.c, which defines a routine `yylex(). This file is compiled and linked with the `-lfl library to produce an executable. When the executable is run, it analyzes its input for occurrences of the regular expressions. Whenever it finds one, it executes the corresponding C code. Some simple examples First some simple examples to get the flavor of how one uses flex. The following flex input specifies a scanner which whenever it encounters the string "username" will replace it with the users login name: %% username printf( "%s", getlogin() ); By default, any text not matched by a flex scanner is copied to the output, so the net effect of this scanner is to copy its input file to its output with each occurrence of "username" expanded. In this input, there is just one rule. "username" is the pattern and the "printf" is the action. The "%%" marks the beginning of the rules. Heres another simple example: int num_lines = 0, num_chars = 0; %% n ++num_lines; ++num_chars; . ++num_chars; %% main() { yylex(); printf( "# of lines = %d, # of chars = %dn", num_lines, num_chars ); } This scanner counts the number of characters and the number of lines in its input (it produces no output other than the final report on the counts). The first line declares two globals, "num_lines" and "num_chars", which are accessible both inside `yylex() and in the `main() routine declared after the second "%%". There are two rules, one which matches a newline ("n") and increments both the line count and the character count, and one which matches any character other than a newline (indicated by the "." regular expression). A somewhat more complicated example: /* scanner for a toy Pascal-like language */ %{ /* need this for the call to atof() below */ #include < math.h > %} DIGIT [0-9] ID [a-z][a-z0-9]* %% {DIGIT}+ { printf( "An integer: %s (%d)n", yytext, atoi( yytext ) ); } {DIGIT}+"."{DIGIT}* { printf( "A float: %s (%g)n", yytext, atof( yytext ) ); } if|then|begin|end|procedure|function { printf( "A keyword: %sn", yytext ); } {ID} printf( "An identifier: %sn", yytext ); "+"|"-"|"*"|"/" printf( "An operator: %sn", yytext ); "{"[^}n]*"}" /* eat up one-line comments */ [ tn]+ /* eat up whitespace */ . printf( "Unrecognized character: %sn", yytext ); %% main( argc, argv ) int argc; char **argv; { ++argv, --argc; /* skip over program name */ if ( argc > 0 ) yyin = fopen( argv[0], "r" ); else yyin = stdin; yylex(); } This is the beginnings of a simple scanner for a language like Pascal. It identifies different types of tokens and reports on what it has seen. The details of this example will be explained in the following sections..

Requirements: No special requirements
Platforms: Linux
Keyword: Digit Fast Lexical Analyzer Flex Input Interpreters Lexical Printf Programming Scanner Yytext
Users rating: 0/10

License: Freeware Size: 880.64 KB
USER REVIEWS
More Reviews or Write Review


FLEX RELATED
Code Management Tools  -  JetPAG 0.6.1
JetPAG is full-LL(k) optimizing parser and lexical analyzer generator. It is focused on high usability, efficiency and readability of generated code. JetPAG performs full L(k) analysis and tails is with powerful optimizations resulting a...
 
Development Tools  -  JFlex 1.4.2
JFlex is a lexical analyzer generator (also known as scanner generator) for Java(tm), written in Java(tm). JFlex is designed to work together with the LALR parser generator CUP. It can also be used together with other parser generators like ANTLR...
 
Development Tools  -  JetPAG 0.6.1
JetPAG is a recursive-descent parser and lexical analyzer generator.It generates optimized recursive-descent recognizers with multi-token lookahead. In short this means that parsers generated by JetPAG scan input stream left-to-right, and predict...
 
Programming  -  Lexical Analyzer Generator Quex 1.0
Generator of extremely fast lexical analysers. Sophisticated input/buffer management. Many character encodings (incl. ASCII, UTF8, UTF16, RUSCII, ...) are directly supported. Regular expressions are specified in the lex/flex style.
1.52 MB  
Development Tools  -  Quex 0.25.7
A lexical analyzer is a program that transforms a stream of characters into a stream of 'atomic chunks of meaning', as shown in the figure below:As a result of the lexical analysis process the list of 'atomic chunks of meaning', so called...
 
Programming  -  C# Flex 1.4
A port to C# of a lexical analyzer tool called JFlex. Produces Java or C# source code files for scanning an input stream and producing a sequence of tokens. Compatible with CUP (Constructor of Useful Parsers).
215.69 KB  
Programming  -  PHP Function Reference 1.0.1
PHP Function Reference provides fast lookup of information about the PHP web programming language. Features * Offline access to the same documentation found on PHP.net * Extensive cheat sheet of common PHP language...
4.73 MB  
Development Tools  -  YaYacc Script 1.0.1
YaYacc stands for Yet Another YaccHere are some key features of "YaYacc":dlTE Transmission of yacc descriptions to template code in C++ language.dlTE The work of the resulting code is the same algorithm LALR(1) as yacc.dlTE Object-oriented method...
614.4 KB  
Development Tools  -  passcode 1.0
answer = PASSCODEcreates a modal dialog box that returns user password input. Given characters are substituted with '*'-Signs like in usual Windows dialogs.answer = PASSCODE without input parameter allows to type any ASCII-Characteranswer =...
10 KB  
Text Editors  -  Quex for Linux 0.57.2
Quex is a tool to generate lexical analyzers. A lexical analyzer is a program that transforms a stream of characters into a stream of 'atomic chunks of meaning', as shown in the figure below: Quex provides a convenient means to...
1.6 MB  
NEW DOWNLOADS IN LINUX SOFTWARE, PROGRAMMING
Linux Software  -  Polling Autodialer Software 3.4
ICTBroadcast Auto Dialer software has a survey campaign for telephone surveys and polls. This auto dialer software automatically dials a list of numbers and asks them a set of questions that they can respond to, by using their telephone keypad....
488 B  
Linux Software  -  Total Video Converter Mac Free 3.5.5
Total Video Converter Mac Free developed by EffectMatrix Ltd is the official legal version of Total Video Converter which was a globally recognized brand since 2006. Total Video Converter Mac Free is a free but powerful all-in-one video...
17.7 MB  
Linux Software  -  Skeith mod_log_sql Analyzer 2.10beta2
Skeith is a php based front end for analyzing logs for Apache using mod_log_sql.
47.5 KB  
Linux Software  -  SLAX 6.0+
Slax is a modern, portable, small and fast Linux operating system with a modular approach and outstanding design. Despite its small size, Slax provides a wide collection of pre-installed software for daily use, including a well organized graphical...
190 KB  
Linux Software  -  GTK+ 2.5
GTK+, which stands for the GIMP Toolkit, is a library for creating graphical user interfaces for the X Window System. It is designed to be small, efficient, and flexible. GTK+ is written in C with a very object-oriented approach. Language bindings...
60 MB  
Programming  -  FLEX-db Digital Asset Manager 3.0.9
FLEX-db - an enterprise Digital Asset Manager (DAM). It ingests and links metadata with files, creates thumbnails, and processes files using business rules. FLEX-db has a JSP client, Java app server for file input and output and an EJB metadata...
21.57 MB  
Programming  -  Libicom 0.9.0
The libicom library is a character based dynamicly linked library for Linux. It is used to remotely control the Icom IC-R8500 wide band receiver via an RS232 link. All call and return parameters to the control functions are character string based....
20.48 KB  
Programming  -  dotdesktop 0.3
Dotdesktop library provides ability to parse desktop entry file and access the information in a convenient way. Desktop entry file format is defined by freedesktop.org, it is used to describe information about an application such as the name and...
327.68 KB  
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  libyasl 0.2
Libyasl is a C++ class library to easily realize TCP/UDP/Multicast clientsand servers in IPv4 and IPv6 environments under GNU/Linux systems.
143.36 KB