[erlang-questions] Strings as Lists
Thu Feb 14 01:09:39 CET 2008
> > Leex is very cool and I have been playing with it some. It generates
> > erlang code which is good. I mostly see it as the solution for parsing
> > files.
> Leex works anything, it assumes the input is a list of integers.
Oh sure, but with a state-stack one can suddenly parse more than
Parsing a quoted string as a token from leex is difficult if you know
that the end-quote might not be included in the chunk you just fed
into leex, but the next chunk read from the tcp stream.
With fully recursive grammars I can see how one wants to let yecc
handle it, but a quoted string is not really recursive: You cant have
a quoted string inside a quoted string the same way you can have, say,
an if-expression inside an if-expression inside an if-expression etc
in a programming language.
Leex is a tool I would use for when I know I have some file of finite
length and I could do a two-pass parsing with yecc as the second
stage, I would not use it for tokenizing SMTP/IRC/NNTP...
I'm looking for a better tool (as in quicker and easier code to
maintain/extend) than writing protocol parsing "by hand".
I reserve the right to be completly mistaken about everything.
More information about the erlang-questions