Ragel

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Ragel
Developer(s) Adrian Thurston
Stable release 6.7 / 2011-05-22
Operating system Unix-like, Windows
Type State machine compiler
License GNU General Public License
Website www.complang.org/ragel/

Ragel is a finite-state machine compiler with output support for C, C++, C#, Objective-C, D, Java, Go and Ruby source code. It supports the generation of table or control flow driven state machines from regular expressions and/or state charts and can also build lexical analysers via the longest-match method. A unique feature of Ragel is that user actions can be associated with arbitrary state machine transitions using operators that are integrated into the regular expressions. Ragel also supports visualization of the generated machine via graphviz.

Ragel visualisation.png

The above graph does the following: take a user input as a series of bytes. If in 48..57 (e.g. '0' to '9') it begins like a number. If 10 is encountered, we're done. 46 is the '.' and indicates a decimal number. 69/101 is uppercase/lowercase 'e' and indicates a number in scientific format. As such it will recognize properly:

2 45 055 46. 78.1 2e5 78.3e12 69.0e-3 3e+3

but not: .3 -5 3.e2 2e5.1

[edit] See also

[edit] External links

Personal tools
Namespaces

Variants
Actions
Navigation
Interaction
Toolbox
Print/export
Languages