Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to obtain a flattened list of tokens

0 views
Skip to first unread message

Lex Yaccer

unread,
Nov 9, 2009, 6:24:39 AM11/9/09
to
Hello,

I want to view a flattened list of all rules for a particular non-
terminal (can be the top-most one too).
So, for something like:

top: middle1 | middle2

middle1: leaf1 leaf2 | leaf3

leaf1: terminal1 | terminal2
leaf2: terminal3 | terminal4
leaf3: terminal5

I would like to see flattened list for middle1 as


middle1: terminal1 terminal3
| terminal2 terminal3
| terminal1 terminal4
| terminal2 terminal4
| terminal5

Thus, all the possible rules for middle1 are flattened out in terms of
its terminals.

[In general it's impossible since recursive rules have a potentially
infinite expansion, but for cases where there's no reference loops
it's just a simple macro expansion. -John]

0 new messages