C++ Logo

std-proposals

Advanced search

Re: Beyond regex

From: Domen Vrankar <domen.vrankar_at_[hidden]>
Date: Tue, 29 Oct 2019 13:36:57 +0100
On Tue, Oct 29, 2019, 9:52 AM Dejan Milosavljevic via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> 1. ... doesn't have any motivation.
> - https://en.wikipedia.org/wiki/Lex_(software)
> - https://en.wikipedia.org/wiki/Comparison_of_parser_generators
> Why so many libraries? C, C#, C++, Java, Haskell, Eiffel, Go.
>

I do have a question regarding this first point and the proposal in general
but just haven't gotten arround to asking.

I'm speaking from memory so I could be wrong but when boost spirit x3 came
out I remember the author saying something regarding lexers not being
needed (as much?) so x3 doesn't have the support for it.

Old spirit had it but even back then I preferred writing parsers without
using it. I always felt that parsing flow should be: grammar -> ast ->
working with ast

And that tokenization beforehand is repeating the grammar writing step and
muddying the code (making it longer, more spread out and thereby less
readable/extensible/maintainable).

I haven't checked the feasability of writing x3 style parsers with the
proposed pattern matching but my guess is that it should eventually be
possible. This would cover all my cases without needing a lexer library.

Can you explain a bit better why having a lexer instead of writing x3
grammar direclty would be preferred and in which cases?

Thanks,
Domen

>

Received on 2019-10-29 07:40:57