Questions tagged [ragel]

Ragel finite-state-machine compiler

Ragel compiles a declarative machine description syntax into a source code file in Java, Ruby, or a bunch of C-like languages. In addition, Ragel can generate a graphviz .dot file containing a diagram of the states and interaction of the input machine.

Ragel can be used to generate general purpose Finite State Machines (FSMs), which are commonly used in embedded systems and in protocol-driven applications like telephony and internet servers.

Ragel can also be used to generate a "lexer" (or "scanner") - a piece of code that scans an input text and divides it into "tokens". This lexical analysis is traditionally the first step in interpreting or compiling computer languages:

input ->  lexer  ->  parser  ->  AST  ->  execution or code generation

Links

81 questions
0
votes
1 answer

How to get Ragel perform different actions for parsing

I am new to Ragel and have been trying to parse a specific pattern of Regex expression. I want action done to be executed if a match is found and parse_error to be executed if there is no match even for any single character missing. Here is the…
gst
  • 1,251
  • 1
  • 14
  • 32
0
votes
1 answer

Compiling errors with Ragel and C++

I am trying to learn Ragel for the past 2 days and have been facing some issues related to the Ragel Syntax. My goal is to write a parser that recognizes Regex commands with C++ as host language. For now I am trying to recognize the following…
gst
  • 1,251
  • 1
  • 14
  • 32
0
votes
0 answers

How writing my own error in Ragel

Ragel is very easy. But how I can write my own error function? I use loop: main := |* *|; and if i get other data I need run my action? and how put error when my token is good gramar but not good good in semantic.
Eliasz Łukasz
  • 478
  • 1
  • 3
  • 17
0
votes
1 answer

Issues with parsing HTML with ragel

In my project I need to extract links from HTML document. For this purpose I've prepared ragel HTML grammar, primarily based on this work: https://github.com/brianpane/jitify-core/blob/master/src/core/jitify_html_lexer.rl (mentioned here:…
Amdei
  • 223
  • 3
  • 8
0
votes
2 answers

Why does Ragel execute to-State and From-State actions twice?

I am testing out the functionality for to- and from-state actions in Ragel. I have the following Ragel program: ragelScaffolding.rl: #include #include #include char *p, *pe; int cs; void runRagelMachine(char…
0
votes
1 answer

Ragel Java outputs [nulla,b] instead of [a,b,c]

I would like to code a CSVReader State Machine in ragel, since I've doned mine in Java with Enums already. The returned list should be [a,b,c] but I get [nulla,b]. I'm using Ragel 6.8 on Fedora 22, I really hope any one could help me This is the…
user4079189
0
votes
2 answers

Where is ragel's source repository

The original address no longer working git://git.complang.org/ragel.git. Google search only shows unofficial repository from the old code. Since its development is under Colm Network now, would Colm Networks still open its development repository?
qunying
  • 428
  • 3
  • 4
0
votes
2 answers

How to create a parser which tokenizes a list of words taken from a file?

I am trying to do a syntax text corrector for my compilers' class. The idea is: I have some rules, which are inherent to the language (in my case, Portuguese), like "A valid phrase is SUBJECT VERB ADJECTIVE", as in "Ruby is great". Ok, so first I…
Vitor Baptista
  • 2,016
  • 1
  • 23
  • 28
0
votes
1 answer

Printing Expected Token Type XXX when a parsing error occurs

I would like to be able to print this error message using Ragel => Parsing error found at position line:col, Integer expected instead. Is that possible with Ragel? Best regards
vadmeste
  • 133
  • 1
  • 6
0
votes
1 answer

UTF-8 match position

Is it somehow possible to get the character position of matched pattern in Ragel? I know a match receives a pointer into the string (char *), i.e. the byte-offset where the pattern was found inside of the string. The problem is that UTF-8 is…
Ecir Hana
  • 10,864
  • 13
  • 67
  • 117
0
votes
1 answer

Ragel and NSMutableString

Is it possible to make Ragel work over NSMutableString? I would like to use Ragel to generate DFA to tokenize an NSMutableString. That "mutable" part means that I cannot use cStringUsingEncoding: whenever single one character changes. As far as I…
Ecir Hana
  • 10,864
  • 13
  • 67
  • 117
0
votes
1 answer

compiling ragel on mavericks

I have downloaded ragel source code and trying to compile it. I am not able to configure it. getting following error on running ./configure --prefix=PREFIX -bash: ./configure: No such file or directory I have download all necessary command line…
user1743514
  • 311
  • 1
  • 3
  • 21
0
votes
1 answer

Prevent Ragel from calling actions multiple times while matching the same string

I have this parser: class Parser %%{ machine test_lexer; action s { s = p; puts "s#{p}" } action e { e = p; puts "e#{p}" } action captured { puts "captured #{s} #{e}" } key_value = "a" %s ("b" | "x" "c")+ %e…
grosser
  • 14,707
  • 7
  • 57
  • 61
0
votes
1 answer

Ragel string matching

I am trying to learn ragel for a project I am working on. I am new to this. I have a list of 15 strings. The problem is to check if a given string matches any of this 15 strings. Under normal circumstances building a hash set with the 15 strings…
mariner
  • 930
  • 3
  • 16
  • 25
0
votes
1 answer

Eclipse: where does it look for executables?

I have a project that uses ragel for parsing. I get this error when I try to compile it. /bin/sh: ragel: command not found So I am guessing eclipse is looking at some path for ragel. Currently ragel is in /usr/local/bin. I am not able to find out…
mariner
  • 930
  • 3
  • 16
  • 25