in reply to Re^4: converting context free grammar to BNF
in thread converting context free grammar to BNF
Hi nido203,
The reason your result looks like that is because of the $::RD_AUTOACTION = q { [ @item ] }; directive, which creates the arrayrefs. Also, <autotree> does create objects (blessed references), which are not always easy to convert to JSON. Parse::RecDescent does provide a hash for each item, so you could put this at the top of your grammar: <autoaction: { \%item } > and you'll get hashrefs. However, those will still contain all of the raw parse results. If you want to customize it, you'll have to look into writing custom actions that return only the values you are interested in. There's of course the Parse::RecDescent docs (especially the section "Actions"), but also this: Some Parse::RecDescent Tutorials
Hope this helps,
-- Hauke D
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: converting context free grammar to BNF
by nido203 (Novice) on Jun 04, 2016 at 13:43 UTC |