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.
Key Features of Flex:
Efficient Programming Model
The Flex SDK includes a compiler, debugger, and hundreds of out of the box components. Using these tools from IDEs, the command line, or from build tools like Ant, code is compiled into cross-platform applications.
In addition to the free SDK, Flex developers can use Flash Builder to build applications. Flash Builder is an IDE for Flex development built on top of Eclipse. It includes a Design View and a sophisticated code view featuring code completion, smart editing and code refactoring. Flash Builder also includes a visual debugger, a visual profiler, a network monitor, and a Services view with service introspection.
Flex applications run on the client either in a browser with Flash Player, on the desktop with Adobe AIR, or on mobile devices. To access back-end databases and other systems Flex has numerous networking APIs supporting everything from plain XML, JSON, SOAP Web Services, and optimized protocols like AMF.
The Flex source code (.mxml and .as files) is compiled into Flash bytecode (.swf) that is executed at the client side by the ActionScript Virtual Machine in Flash Player or Adobe AIR.
The Flash Platform runtimes, Flash Player and Adobe AIR, are cross-platform runtimes that work consistently on a variety of hardware, operating systems, and browsers.
The Flex SDK contains hundreds of out-of-the-box components. DataGrids, Charts, Formatters, Validators, and numerous other UI controls are the building blocks for applications of all sizes. Components can be styled and skinned to fit the look and feel you want. There are also hundreds of third party open source and commercial components available for Flex. Mapping APIs, Data Visualization libraries, and Cloud APIs provide the building blocks for assembling great applications. Check out Tour de Flex to see many of the available components for Flex.
By doing data visualization and UI interactions on the client-side less time is spent waiting for a server to respond. This offloading and client-side state handling makes back-ends more scalable and efficient. Interactions like filtering and sorting no longer need to round-trip all the way to the server or database. This makes software more responsive and easier to use.