[erlang-questions] extending the scanner and parser

Vlad Dumitrescu <>
Sat Oct 4 20:27:56 CEST 2008


On Sat, Oct 4, 2008 at 20:15, Robert Virding <> wrote:
> Another solution which may help you is to use leex for generating the
> scanner. It gives you much more freedom in deciding what to return, so you
> could return both the value and/or the chars if you wish. However, I don't
> think it will give all the data you want, you can the line number,
> characters and length of each token.
>
> If you want to use yecc for generating the parser, which really does
> simplify matters,  you have to a little circumspect because it only accepts
> tokens in the form {Type,Line} or {Type,Line,Value}. It does place any
> restrictions on the vaule.

Thank you for the advice! I considered that, but I'd rather use the
standard lexer and parser, to be sure the results are exactly the same
as they should (except the presentation). Actually, now that I think
of it, I did try it, but got trouble with the more esoteric parts
(like multi-line strings) and abandoned that path. Maintenance would
still be a headache.

best regards,
Vlad



More information about the erlang-questions mailing list