Presently, parse drivers are flush with parse_this and parse_that which simply delegate to creating a node structure of some kind. Suppose instead the standard mechanism could handle this part for you, most of the time, based on a "generic" node structure and a tag. Throw in a convenient double-dispatch/visitation mechanism.
You save a bunch of noise in parse drivers, and you can also meld semantic modules together for doing things like sharing the regex language between miniscan and macroparse. With any luck, much of the current bootstrapping code also goes away.
The idea is incomplete, but a quick observation is this: in support/runtime.py, the function parse_action_bindings(...) has a subfunction bind(...) which interprets the (symbolic) messages of the message catalog. In contrast, the miniparse path sends the actual parse-action functions through as the messages attached to the grammar. Thus, miniparse would need an extra rule-type method, and MacroParse would need some way to say the same thing -- possibly a semicolon where a (full) colon currently goes in front of the (final) action on a production rule. (Internal actions probably do not change.)
Presently, parse drivers are flush with
parse_this
andparse_that
which simply delegate to creating a node structure of some kind. Suppose instead the standard mechanism could handle this part for you, most of the time, based on a "generic" node structure and a tag. Throw in a convenient double-dispatch/visitation mechanism.You save a bunch of noise in parse drivers, and you can also meld semantic modules together for doing things like sharing the regex language between miniscan and macroparse. With any luck, much of the current bootstrapping code also goes away.
The idea is incomplete, but a quick observation is this: in
support/runtime.py
, the functionparse_action_bindings(...)
has a subfunctionbind(...)
which interprets the (symbolic) messages of the message catalog. In contrast, the miniparse path sends the actual parse-action functions through as the messages attached to the grammar. Thus, miniparse would need an extrarule
-type method, and MacroParse would need some way to say the same thing -- possibly a semicolon where a (full) colon currently goes in front of the (final) action on a production rule. (Internal actions probably do not change.)