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

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

Serving Software Downloads in 956 Categories, Downloaded 50.060.559 Times

Flex 2.5.33

  Date Added: October 14, 2010  |  Visits: 3.696

Flex

Report Broken Link
Printer Friendly Version


Product Homepage
Download (327 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
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  
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  
Programming  -  Dependency Analyzer 1.0.3 RC0
Dependency Analyzer is a utility for graphically visualizing Maven2 artifacts dependency graphs. It is using Maven embedder for resolving dependencies and based the Java Universal Network/Graph Framework (Jung) for creating and visualizing the...
7 MB  
Libraries  -  Linux::Input 1.02
Linux::Input is a Linux input event interface. SYNOPSIS Example: 1 joystick using event API my $js1 = Linux::Input->new(/dev/input/event3); while (1) { while (my @events = $js1->poll(0.01)) { foreach (@event) { } } } Example: 2...
6.14 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  
Libraries  -  Ruby/FLTK 0.9.6
Ruby/FLTK is a Ruby binding for the FLTK (Fast Light ToolKit) GUI library. It works fine with OpenGL on UNIX, Cygwin and MinGW environment..
 
Libraries  -  Math::BaseCnv 1.2.59M7mRX
Math::BaseCnv is a fast functions to convert between number bases. SYNOPSIS use Math::BaseCnv; # Convert 63 from base-10 (decimal) to base-2 (binary) $binary_63 = cnv( 63, 10, 2 ); BaseCnv provides a few simple functions for converting...
13.31 KB  
Libraries  -  vtmalloc 1.2
vtmalloc is a fast memory allocator for multi-threaded applications and Tcl. vtmalloc project provides low contention and the ability to return memory to the system. Tcl Replace exiting tclThreadAlloc. in the Tcl distribution and recompile...
13.31 KB  
Graphics Editors  -  MUIbase 2.11
MUIbase is a relational, programmable database with graphical user interface for Windows, Mac, Linux and Amiga. MUIbase is a fast and flexible database system. It is targeted for advanced desktop users who want to manage data in a...
12.71 MB  
Network & Internet  -  DataReel 4.30
Datareel project is a comprehensive development kit used to build multi-threaded database and communication applications. C++ is a programming language that produces fast executing compiled programs and offers very powerful programming...
1.4 MB  
NEW DOWNLOADS IN LINUX SOFTWARE, PROGRAMMING
Linux Software  -  EasyEDA PCB Designer for Linux 2.0.0
EasyEDA, a great web based EDA(Electronics Design Automation) tool, online PCB tool, online PCB software for electronics engineers, educators, students, makers and enthusiasts. Theres no need to install any software. Just open EasyEDA in any...
34.4 MB  
Linux Software  -  wpCache® WordPress HTTP Cache 1.9
wpCache® is a high-performance, distributed object, caching system application, generic in nature, but intended for use in speeding up dynamic web applications, by decreasing database load time. wpCache® decreases dramatically the page...
3.51 MB  
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  
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  -  Math::GMPf 0.29
Math::GMPf - perl interface to the GMP library's floating point (mpf) functions.
30.72 KB  
Programming  -  Net::Wire10 1.08
Net::Wire10 is a Pure Perl connector that talks to Sphinx, MySQL and Drizzle servers. Net::Wire10 implements the low-level network protocol, alias the MySQL wire protocol version 10, necessary for talking to one of the aforementioned...
30.72 KB  
Programming  -  logilab-common 0.56.2
a bunch of modules providing low level functionnalities shared among some python projects devel Please note that some of the modules have some extra dependencies. For instance, logilab.common.db will require a db-api 2.0 compliant...
174.08 KB  
Programming  -  OpenSSL for linux 1.0.0a
The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a...
3.83 MB