D
Day
So I'm building a parser, and I thought I'd give TreeTop a go. I
recently got Practical Ruby Projects from Apress and worked through
the last chapter, so I feel like I have somewhat of an understanding
of what's going on, but I'm having a weird issue. It is apparent to me
that the order you define rules in TreeTop matters.
The stuff I'll be parsing (somewhat simplified) looks like this:
Item, name(value), name(value), name(value)...etc.
Here's my grammar and test script: http://pastie.caboo.se/149766
This fails. If I comment out the item and item_name rules and then
change the string to be parsed to just 'bar(1), baz(14)' it works. i
can't figure out what the order of the rules might imply (if I reorder
them, it breaks again). Any help or pointing at some documentation
more in-depth than that found on the TreeTop site would be much
appreciated. Thanks.
Ben
recently got Practical Ruby Projects from Apress and worked through
the last chapter, so I feel like I have somewhat of an understanding
of what's going on, but I'm having a weird issue. It is apparent to me
that the order you define rules in TreeTop matters.
The stuff I'll be parsing (somewhat simplified) looks like this:
Item, name(value), name(value), name(value)...etc.
Here's my grammar and test script: http://pastie.caboo.se/149766
This fails. If I comment out the item and item_name rules and then
change the string to be parsed to just 'bar(1), baz(14)' it works. i
can't figure out what the order of the rules might imply (if I reorder
them, it breaks again). Any help or pointing at some documentation
more in-depth than that found on the TreeTop site would be much
appreciated. Thanks.
Ben