[Sbp-users] Indentation (tree) parsing

Adam Megacz megacz at cs.berkeley.edu
Sat May 1 21:23:21 EDT 2010


Yang Zhang <yanghatespam at gmail.com> writes:
> Hi, I'm interested in parsing this text:
> ...
> I was borrowing the technique outlined in the LDTA06 paper, but I
> can't seem to really hack it. Here's my current grammar:

Hi, sorry about the slow reply here; I'm usually quicker.

The technique used in the LDTA06 paper only applies when the arity of
each tree node can be determined by examining its head.  In the grammar
given in that paper, the tree has fixed arity (every non-leaf node is of
degree 2).

I've added a new regression test (see the end of regression.tc) that
shows how to do indentation-based parsing for binary trees.  It should
be straightforward to adapt it to any fixed arity, and it shouldn't be
hard to see how to do varying arity as long as you can determine the
arity from the head of the node.

I believe that variable arity parsing (where the arity is determined
from the indentation, like in Haskell) is possible, but I haven't had
time to work it out yet.

  - a




More information about the Sbp-users mailing list