[erlang-questions] extending the scanner and parser

Kenneth Lundin kenneth.lundin@REDACTED
Mon Oct 6 21:25:47 CEST 2008


On Sat, Oct 4, 2008 at 8:27 PM, Vlad Dumitrescu <vladdu55@REDACTED> wrote:
> On Sat, Oct 4, 2008 at 20:15, Robert Virding <rvirding@REDACTED> wrote:
>> Another solution which may help you is to use leex for generating the
>> scanner.
As I said we plan to integrate the required functionality in the
official scanner and we can not
have dependencies to components which are not part of the distribution
in the scanner.
We also already have the scanner so there is really no need to
implement a new one with Leex.

It might whowever be a good thing to have leex as part of the
distribution but we can take that dicusssion separately.

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.

We already use yecc for the parser and it will be no problem to e.g.
let the Line info in the tokens
be an arbitrarily complex tuple instead.
>
> 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
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
/Kenneth Erlang/OTP team, Ericsson



More information about the erlang-questions mailing list