ronsavage / marpa.faq

The Marpa FAQ
http://savage.net.au/Perl-modules/html/marpa.faq/faq.html
GNU General Public License v3.0
0 stars 2 forks source link

New FAQ Q on ambiguity #12

Open jeffreykegler opened 9 months ago

jeffreykegler commented 9 months ago

I want to add a new FAQ Q in the section "About Marpa", at the end.

Marpa parses ambiguous grammars. So what?

If you want to avoid ambiguity in your grammar, Marpa is the best tool for it. Others parsers refuse to allow ambiguous grammars, do not issue a message pointing out the ambiguity, and exclude a lot of useful unambiguous grammars. They kill all your enemies, but they kill a lot more friends.

Marpa gives you a choice. You can keep working on other aspects of your grammar's project, and deal with the ambiguity later. But Marpa can also tell you exactly where the ambiguity occurs in an ambiguous parse. (Marpa does this by taking two of the ambiguous parses and comparing them -- a capability that parsers which don't handle ambiguous grammars do not have.)

On the other hand, you may not want to reject ambiguity so quickly. Humans, given the choice, prefer to communicate in ambiguous languages. For example, English, the language you are reading now, is highly ambiguous. Ambiguity can be used as a feature, instead of rejected as a bug. For more on this, see my blog post on the topic.

jeffreykegler commented 9 months ago

Per our exchange on the IRC channel, I am putting together a pull request. I will keep you updated.

jeffreykegler commented 9 months ago

I just created pull request #13 for this.

ronsavage commented 9 months ago

Hi Jeffrey

I've slightly reworded the 1st para in your new text. Can reword again if you're not happy.

So I've checked the renumbering and all looks good :-), so I uploaded it to my web site.

All checked in to the dev branch.

-- Cheers, Ron

savage.net.au