tzlaine / parser

A C++ parser combinator library.
Boost Software License 1.0
70 stars 12 forks source link

Docs: what is a parser? #41

Closed akrzemi1 closed 6 months ago

akrzemi1 commented 6 months ago

In Boost.Parser, what is considered a parser? Is it:

It looks like it is the former. I recommend devoting a section to Parser. It would say:

akrzemi1 commented 6 months ago

Can you specify what it means to be a parser as a c++ concept (even if you do not use concepts in the implementation)?

If I define a class that only has the two call operators and nothing else, will it work as a parser with your library?

akrzemi1 commented 6 months ago

It looks to me that when I need to create a parser:

akrzemi1 commented 6 months ago

In section Parsing In Detail, I do not understand this sentence:

Step 1) The input is "1 2 3", and the stack of active parsers is int_pairs_plus -> +int_pair -> int_pair -> bp::int_.

Is this a mistake? Or is it correct? But what does the arrow represent here? Does this mean a four-element stack?

tzlaine commented 6 months ago

In section Parsing In Detail, I do not understand this sentence:

Step 1) The input is "1 2 3", and the stack of active parsers is int_pairs_plus -> +int_pair -> int_pair -> bp::int_.

Is this a mistake? Or is it correct? But what does the arrow represent here? Does this mean a four-element stack?

Yes, this is right. I'll add more text to make it clearer what I mean. Bascially, since each parser is a callable, there is a stack of parsers from the top-level one down to the current parser.

tzlaine commented 6 months ago

In section Parsing In Detail, I do not understand this sentence:

Step 1) The input is "1 2 3", and the stack of active parsers is int_pairs_plus -> +int_pair -> int_pair -> bp::int_.

Is this a mistake? Or is it correct? But what does the arrow represent here? Does this mean a four-element stack?

Add a separate issue for this.