Next, let's parse something and get an abstract syntax tree:
print grammar.parse('((bold stuff))')
<Node called "bold_text" matching "((bold stuff))">
<Node called "bold_open" matching "((">
<RegexNode called "text" matching "bold stuff">
<Node called "bold_close" matching "))">
May I suggest that was produced here is not an abstract syntax tree, but a concrete syntax tree. An AST would be something like:
<Node called "bold_text" matching "((bold stuff))">
<RegexNode called "text" matching "bold stuff">
Whereas parsimonious' output contains every syntactic/punctuational detail like those "((", which are cruft from user's perspective.
Indeed, as the following ini-parsing example shows, it takes an additional step to convert parsimonious' CST to user-useful AST, using node visitors and statements like:
From README:
May I suggest that was produced here is not an abstract syntax tree, but a concrete syntax tree. An AST would be something like:
Whereas parsimonious' output contains every syntactic/punctuational detail like those
"(("
, which are cruft from user's perspective.Indeed, as the following ini-parsing example shows, it takes an additional step to convert parsimonious' CST to user-useful AST, using node visitors and statements like: