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
In reply to Re^5: converting context free grammar to BNF
by haukex
in thread converting context free grammar to BNF
by nido203
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |