ylixir / phap

Php Has Another Parser
GNU Lesser General Public License v3.0
4 stars 1 forks source link

Consider accepting strings as well as parsers #10

Open ylixir opened 5 years ago

ylixir commented 5 years ago

It might be nice to make lit implied when passing strings.

p::or(p::lit("a"),p::lit("b")) compared to p::or("a","b").

Concerns might be that we trade convenience for safety and speed.

ylixir commented 5 years ago

we should do this. the main tradeoff here is weaker type guarantees creating more implementation complexity.

the primary goal of this library is to make creating parsers as easy as possible.

i feel that the Php community will strongly prefer ease of use to guarantees of correctness, and the added complexity will not be visible to our users. in addition we have a good testing story to mitigate issues caused by this complexity