On Thu, May 12, 2011 at 12:39 AM, Alexander Tsyplakov <t...@academ.org> wrote:
> Dale Schumacher wrote Tuesday, May 10, 2011, 22:33:18:
> DS> You give this example:
>
> AT> id_0 <- e_0 (?) id_1: e_1 / id_2: e_2 / ... / id_n: e_n
> AT> is essentially equivalent to
> AT> id_0 <- id_1 / id_2 / ... / id_n / e_0
> AT> id_1 <- e_1, e_0
> AT> ...
> AT> id_n <- e_n, e_0"
>
> DS> Did you mean:
>
> DS> id_1 <- e_0, e_1
> DS> ...
> DS> id_n <- e_0, e_n
>
> Yes. It was my oversight.
>
> DS> I'm still not clear on what you expect the resulting
> DS> parse-tree to look like.
>
> For example, consider (from that old message)
>
> Expr <- Num (*) Sum: '+', Num / Diff: '-', Num
>
>
> 1 produces ((1, Num), Expr)
>
> 1-2-3 produces ((((1, Num), (2, Num), Diff), (3, Num),
> Diff), Expr)
>

Let's take this slow, so an old guy like me can follow...

Assuming the grammar:

Expr <- Sum / Diff / Num
Sum <- Num, '+', Num
Diff <- Num, '-', Num

"1" produces ((1, Num), Expr)

Why not (Expr, (Num, 1))?  This is a minor issue.  I can accept a
suffix tag instead of a prefix tag.

"1-2" produces (((1, Num), (2, Num), Diff), Expr)

Why not (((1, Num), '-', (2, Num), Diff), Expr)?  How do you decide,
or indicate, that you should drop the '-' token?

Given:

Tuple <- Num, (',', Num)*

What should "1,2,3" produce? and why?

Given:

Tuple <- Num, ',', Tuple / Num

Does "1,2,3" produce something different? and why?

_______________________________________________
PEG mailing list
PEG@lists.csail.mit.edu
https://lists.csail.mit.edu/mailman/listinfo/peg

Reply via email to