Notes on "Parsing: Top-down versus bottom-up"

16 views
Skip to first unread message

skva...@gmail.com

unread,
Nov 19, 2014, 8:51:08 AM11/19/14
to marpa-...@googlegroups.com
Hi!

First of all, thank you for an interesting article.

I think the example "a + b + c + d + e + f + [....]" is incomplete.
You didn't specify the exact grammar.
It's clear that you mean a left-recursive grammar rule "Sum <--- Sum + id",
but it's incorrect to say that top-down parsers cannot parse "a + b + c + d + e + f + [....]":
depending on the underlying grammar, they might be able to do it.
Right-recursive grammar rule "Sum <--- id + Sum" will do.
Left-recursive rule can be rewritten to get rid of left recursion.

An unexperienced person might get an impression that the plus "+"
is somehow implying left recursion, and that is obviously wrong.

Once again, thank you for a very interesting series of articles!

Jeffrey Kegler

unread,
Nov 19, 2014, 2:42:10 PM11/19/14
to Marpa Parser Mailing LIst
Thanks!  I am glad you found it interesting.

In the post I do say that I elide a lot of detail and, yes, I do assume that "a + b + c ..." is parsed in the standard, left-recursive, way.  What level of presentation to take is hard, but I took the chance in this assuming that non-experts would assume the standard behavior, and that experts like yourself would see what I meant, as in fact you did.

I usually avoid meta-talk to reduce clutter, but I started this post off with a statement of the level of detail I would aim at, and an explanation of why.  And I do advise the readers that much of the detail necessary to actually implement is skipped over.

There are many detail-oriented presentations of this topic, and they are often excellent at what they do.  But IMHO conceptual understanding of this field has lagged, and much of the reason is due to lack of boldness in simplifying down to the core details.

--
You received this message because you are subscribed to the Google Groups "marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email to marpa-parser...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

skva...@gmail.com

unread,
Nov 19, 2014, 3:55:09 PM11/19/14
to marpa-...@googlegroups.com
Yes, people are scared of LR-family dark magic, and I'm all for your simplistic approach.
What I wanted to say is that left recursion is in the grammar rule, not in the nature of plus operator ----
sometimes people confuse the language with an arbitrary grammar for that language,
and that is the root of debates about C++ context sensitivity and the likes.
Reply all
Reply to author
Forward
0 new messages