On 18/12/2007, <b class="gmail_sendername">Hasan Veldstra</b> <<a href="mailto:hasan.veldstra@gmail.com">hasan.veldstra@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;">
<br>> No OTP code uses Leex it seems. All apps and libraries roll their own<br>> lexer.<br>><br>> It's very easy in Erlang to roll your own lexer but any particular<br>> reason why Leex is not used more often?
</blockquote><div><br>Two reasons to use leex:<br><br>1. If your tokens can be described by regular expressions then reading a leex file is much clearer and easier than writing code.<br><br>2. The resultant scanner is re-entrant which fits i/o. This is not that difficult to do by yourself but why bother.
<br><br>The leex generated scanner is relatively efficient but you can do better yourself.<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;">
Perhaps because it's old and unsupported by anyone? (It doesn't even<br>have a homepage.) That coupled with the ease of writing a lexer is<br>probably the reason.</blockquote><div><br>This is the main reason not to use leex.
<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've used Leex quite a lot though, and it works fine. There are a few<br>minor annoyances, but no show-stoppers. (I might even get round to
<br>fixing them at some point...)</blockquote><div><br>Thank you, I wrote it. :-) There is a version on trapexit that doesn't have a manual but at least an example file. :-) Which is almost the erlang token syntax. It needs a bit of a cleanup and perhaps reworking the input file format. There is a bug which sometimes occurs. It could quite easily be modified to work directly on binaries.
<br><br>One of these days I will get around to it. Now I am fixing a lisp based syntax for Erlang. Perhaps not useful but fun. And easy to make a macro preprocessor for.<br><br>Robert<br><br></div></div>