lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, May 30, 2011 at 9:15 PM, Miles Bader <miles@gnu.org> wrote:
> Wesley Smith <wesley.hoke@gmail.com> writes:
>> I would highly recommend using lpeglist [1] for writing parsers
>> because you can divide the lexer and parser into two steps as it
>> should be where the lexer generates an array of tokens and the parser
>> runs over the tokens to build the AST.
>
> Hmm, but why would you _want_ to do that?

When you have anything more that a very simple grammar, it makes
debugging much easier, which is worth much more in my mind than have
everything in a single pass.  Also, it's trivial to generate both a
lexer and parser from the same grammar so there is no cost beyond the
generation of the intermediate token stream.

wes