I'm wondering if there is a conventional name for the result of applying a single production rule in the course of parsing?
So say my grammar has this production:
attr -> NAME, EQUAL, TEXT
Then in the course of parsing I match that production and have a small collection of data that represents the substitution/match:
((NAME, 'foo'), (EQUAL, '='), (TEXT, 'bar'))
What would convention dictate that be called? The candidates I've collected so far are:
- production -- I don't like this option because despite these items being what was "produced" by application of the rule, the 'attr -> NAME, EQUAL, TEXT' bit already lays legitimate claim to that term.
- partial derivation -- I'd prefer a single word, but this makes sense to me as the entire parse result is a derivation and this is one "atom" or step of that derivation.
- replacement -- I kind of like this one okay, but it seems a little generic.
Aside from an obsessive desire to fully articulate the solution domain, a function (perhaps match(rule, tokens)
) that takes a production rule and returns the matching tokens (and/or resolved non-terminals) needs a name for what it returns (or at least its caller does).
The next step, in my case anyway, is to use these values to produce a node in the abstract syntax tree (AST), but that node is a separate object with potentially different form and additional fields.
Does someone with wider experience in parsing and compiler terminology know of a term that would be appropriate for this?