• Home
  • Most Popular
  • Submit
  • About Us
  • Contact Us

Softpile

Free Downloads

Categories
  • Home
  • Most Popular
  • Communications
  • Desktop
  • Games & Entertainment
  • Graphic Apps
  • Network & Internet
  • Security & Privacy
  • System Utilities
Alternative to itextsharp 2022.11.10347
IronPDF offers an itextsharp alternative for HTML to PDF conversion with C# code examples, documentation, and ...
VShell Server for Linux and Mac 4.8
VShell is a versatile and secure file transfer server that supports multiple protocols and is compatible ...
PDF Studio PDF Editor for Linux 2022
PDF Studio is a cost-effective PDF editor that delivers full compatibility with the PDF Standard. It's ...
VQ Probe for Linux 1.5
VQ Probe is a comprehensive software tool that enables objective and subjective video quality analysis. The ...
Resilient Server 2.3
This Debian GNU/Linux (Buster) based software has a customized partitioning scheme that enhances robustness against filesystem ...
Valentina Studio for Linux 9.6
Valentina Studio is a cross-platform GUI manager for Mac, Windows, and Linux. It allows users to ...
VPN Lifeguard for Linux 1.0.58
The software monitors VPN connection and automatically terminates apps during connection loss, re-establishes the connection and ...
G_Viewer 0.84
G_Viewer is a Linux software that serves as both a file system and photo/image viewer. It ...
Checksome File Hash Tool for Linux 1.1
This software allows for the generation and verification of file hashes. It is a quick and ...
KeyWrangler Password Manager for Linux 1.2
A password management software that is secure, offline and extensible. It offers military-grade encryption to protect ...
Home Linux Flex Download

Flex

February 27, 2008
Flex is a high-speed parser generator tool that is used to create lexical analyzers.
Version 2.5.35
License GPL
Platform Linux
Supported Languages English
Homepage flex.sourceforge.net
Developed by Vern Paxson
Flex is a fast lexical analyzer generator that generates programs capable of pattern-matching on text. It's a non-GNU free implementation of the well-known Lex program. Scanners are programs that recognize lexical patterns in text, and Flex is a tool for generating those scanners. Flex takes input files (or standard input if no file names are given) and reads them to produce a scanner description. This description is in the form of regular expression and C code pairs, called rules. Once the rules are defined, Flex generates a C source file ("lex.yy.c") that defines a routine "yylex()" and compiles and links it with the "-lfl" library to create an executable. When run, the executable analyzes its input for occurrences of the defined regular expressions and executes the corresponding C code.

To get a sense of how Flex works, here are some simple examples. The first example specifies a scanner that replaces the string "username" with the user's login name:
```
%%
username printf("%s", getlogin());
```
This scanner has only one rule: "username" is the pattern and "printf" is the corresponding action. The default behavior of Flex is to copy any text not matched by a scanner to the output. Thus, in this example, the input file is copied to the output with each occurrence of "username" expanded.

The second example counts the number of characters and lines in its input:
```
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 has two rules: one that matches a newline and increments both the line count and the character count, and another that matches any character other than a newline and increments only the character count. The scanner produces no output other than the final report on the counts.

A more complex example is a scanner for a toy Pascal-like language:
```
%{
#include
%}
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 scanner recognizes different types of tokens and reports on what it has seen. The scanner first includes a math library needed for the "atof()" function. Next, the regular expressions and corresponding C code for each type
What's New

Version 2.5.35: N/A

Free Download 881K
334
  • Share on:

Most Popular

  1. Quicksilver Forums 1.4.2
    154
  2. Dvgrab 3.4
    102
  3. DynVPN 1.0
    89
  4. CherryTV 0.1
    81
  5. SlideMap 1.2.2
    80
  6. porm r2
    73
  7. Clewarecontrol 0.8
    72
  8. Java Games 1.0
    72
  9. Swiftfox 3.0b5pre-2
    71
  10. fuseftp 0.8
    71

Related Downloads

Recover Linux Deleted Files
Recover Data for Linux offers a dedicated Linux recovery tool to retrieve ...
BLD
BLD is a blacklist daemon designed to function as a blacklist server.
EasyRPG
This software is a free emulator for RPG Maker 2000/2003 games. It ...
sorl-thumbnail
Django thumbnail is a software package that helps create thumbnail images for ...
ZS4
ZS4 is a free video editor with over 150 built-in video effects, ...
Visual Paradigm for UML Modeler Edition
Visual Paradigm for UML is a user-friendly software that assists in UML ...
An open Quality of Service Architecture
The Open Quality of Service Architecture is designed for providing Quality of ...
moonOS K
moonOS is a user-friendly Ubuntu-based operating system designed for the i386 architecture. ...
Microdrive Live Linux
Microdrive Live Linux is a miniscule operating system that runs directly from ...
Hotwire
Hotwire is a Unix shell replacement software that focuses on executing commands ...
Copyright © 1999-2025 Softpile Free Downloads
  • Most Popular
  • Submit
  • About Us
  • Contact Us
  • Privacy Policy
  • Disclaimer
  • Terms of Use

Can we use your data to tailor ads for you?

Our partners will collect data and use cookies for ad personalization and measurement.

By choosing "I agree", closing this pop-up or clicking on any element on the page, you agree to the use of cookies to help us provide you with a better user experience.

Learn how Softpile and our partners collect and use data.

You can change your choice at any time in our privacy center.

Cookie Settings

Our website stores four types of cookies. At any time you can choose which cookies you accept and which you refuse. You can read more about what cookies are and what types of cookies we store in our Cookie Policy.

are necessary for technical reasons. Without them, this website may not function properly.

are necessary for specific functionality on the website. Without them, some features may be disabled.

allow us to analyse website use and to improve the visitor's experience.

allow us to personalise your experience and to send you relevant content and offers, on this website and other websites.