On 13/02/2008, <b class="gmail_sendername">Christian S</b> <<a href="mailto:chsu79@gmail.com">chsu79@gmail.com</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Feb 13, 2008 5:00 AM, Zvi <<a href="mailto:exta7@walla.com">exta7@walla.com</a>> wrote:<br>> How Ragel is better, than other lexical analysers? Do you use it primarily<br>> because it's parsing binary input, why Erlang leexer working with lists?<br>
<br>Leex is very cool and I have been playing with it some. It generates<br>erlang code which is good. I mostly see it as the solution for parsing<br>files.</blockquote><div><br>Leex works anything, it assumes the input is a list of integers. However when building the DFA for generating the scanner it assumes 8 bit input. :-( This, however, is not critical and I have code which would work on *any* input characters. :-) It would then be able to handle any characters in the leex .xrl file if you could write the (32-bit) characters and read them in as a list of integers. Once you get the file into a list you could probably get it into the Erlang scanner without to much trouble. Just as long you were a little careful.<br>
<br>As I said lists *are* wonderful for representing strings.<br><br>As an aside I can mention that a new regexp package I have does work directly on binaries. But, much more fun, it also works on lists of anything, not just integers. So you can define regexps that work on lists of atoms or tuples or whatever. Do that with UTF-8! :-)<br>
<br>Robert<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I want non-greedy matching, and also some push down automata support.<br>
Ragel can do this. With it you can parse quoted strings as a single<br>token, and still have incremental parsing (i.e. in chunks). The fact<br>that you generate C code from Ragel can also be beneficial in speed<br>but of course risky. The higher-level programming of using Ragel can<br>
hopefully decrease risk of security problems.</blockquote><div><br>Non-greedy is a bit difficult to do if you compile down to pure code like leex (or lex) but if you do it by interpreting a datastructure then it is not hard. <br>
</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I'm really just experimenting with Ragel as a tool. I still suck at it<br>after having spent ~6 hours or so with it.</blockquote>
<div><br>Robert<br><br></div></div>