Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
3Activity
0 of .
Results for:
No results containing your search query
P. 1
Ragel Guide 6.5

Ragel Guide 6.5

Ratings: (0)|Views: 423|Likes:
Published by newtonapple
Ragel compiles executable finite state machines from regular languages. Ragel targets C, C++, Objective-C, D, Java and Ruby. Ragel state machines can not only recognize byte sequences as regular expression machines do, but can also execute code at arbitrary points in the recognition of a regular language. Code embedding is done using inline operators that do not disrupt the regular language syntax. The core language consists of standard regular expression operators (such as union, concatenation and Kleene star) and action embedding operators. The user's regular expressions are compiled to a deterministic state machine and the embedded actions are associated with the transitions of the machine. Understanding the formal relationship between regular expressions and deterministic finite automata is key to using Ragel effectively.
Ragel compiles executable finite state machines from regular languages. Ragel targets C, C++, Objective-C, D, Java and Ruby. Ragel state machines can not only recognize byte sequences as regular expression machines do, but can also execute code at arbitrary points in the recognition of a regular language. Code embedding is done using inline operators that do not disrupt the regular language syntax. The core language consists of standard regular expression operators (such as union, concatenation and Kleene star) and action embedding operators. The user's regular expressions are compiled to a deterministic state machine and the embedded actions are associated with the transitions of the machine. Understanding the formal relationship between regular expressions and deterministic finite automata is key to using Ragel effectively.

More info:

Published by: newtonapple on Sep 16, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/11/2014

pdf

text

original

 
Ragel State Machine Compiler
User Guide
by
Adrian Thurston
 
License
Ragel version 6.5, May 2009Copyrightc
2003-2007 Adrian Thurston
This document is part of Ragel, and as such, this document is released under the terms of theGNU General Public License as published by the Free Software Foundation; either version 2 of theLicense, or (at your option) any later version.Ragel is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR-POSE. See the GNU General Public License for more details.You should have received a copy of the GNU General Public License along with Ragel; if not, writeto the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
i
 
Contents
1.1 Abstract. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Motivation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.3 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4 Related Work. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.5 Development Status. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1 Ragel State Machine Specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.1.1 Naming Ragel Blocks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.1.2 Machine Definition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.1.3 Machine Instantiation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.1.4 Including Ragel Code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.1.5 Importing Definitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.2 Lexical Analysis of a Ragel Block. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.3 Basic Machines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.4 Operator Precedence. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.5 Regular Language Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.5.1 Union. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.5.2 Intersection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.5.3 Difference. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.5.4 Strong Difference. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.5.5 Concatenation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142.5.6 Kleene Star. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.5.7 One Or More Repetition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162.5.8 Optional. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162.5.9 Repetition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.5.10 Negation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.5.11 Character-Level Negation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.6 State Machine Minimization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.7 Visualization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.1 Embedding Actions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193.1.1 Entering Action. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193.1.2 Finishing Action. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203.1.3 All Transition Action. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20ii

Activity (3)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
h4ck3rm1k3 liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->