Ragel

from Wikipedia, the free encyclopedia
QS IT
This article was due to content flaws on the quality assurance side of the computer science editorial added. This is done in order to bring the quality of the articles from the subject area of ​​computer science to an acceptable level. Help to eliminate the shortcomings in this article and take part in the discussion !  ( + )

Ragel is a state machine compiler developed by Adrian D. Thurston . He translates definitions of finite state machines (FSM, also called finite automaton ) into executable program code. For this purpose, nondeterministic finite automata can be described in Ragel's own language, the operators of which mainly consist of standardized regular expressions (similar to concatenation or Kleen's and positive envelope ). These definitions are embedded in the code of the target language. The compiler first converts these into deterministic finite automata , minimizes them and then translates them into the target language.

Ragel supports a variety of target languages: C , C ++ , assembly language , D , Go , Java , Ruby and C # . The compiler also offers various options to influence the generated code. To implement the transition table , z. For example, an array (table-driven) can be used or the states are translated directly into program code (control flow driven).

The distinguishing feature of Ragels is that it allows code in the target language to be linked with state transitions. This is carried out automatically by the generated code as soon as the corresponding transition takes place. Ragel offers a large number of operators for this, which allow code to be attached to various transitions. In addition to pure verification or falsification, this also makes it possible to carry out additional tasks (e.g. converting numbers in decimal format into binary form).

Ragel also allows for visualization of the transition table by Graphviz :

Ragel output visualization

Individual evidence

  1. Adrian D. Thurston: Ragel State Machine Compiler. In: www.colm.net. Retrieved August 10, 2016 .
  2. Adrian D. Thurston: Ragel State Machine Compiler User Guide. In: www.colm.net. Retrieved September 7, 2016 .