Back Next

Spanner in the Works

Implementation of our compiler leaps along, operator after operator implemented using the factory pattern, until we meet an interesting problem:
expression
    : IDENTIFIER
        { $$ = context->expression_identifier($1); }
    ; 
 expression *
translator_pretty::expression_identifier(const char *name) {
    return new expression_identifier_pretty(name); }
class translator {
    blah blah public:
    virtual expression *expression_identifier(
        const char *name) = 0;
    blah blah }; 
 expression *
translator_compile::expression_identifier(const char *name) {
    return new expression_identifier_compile(name); }

But is that a left hand side identifier, or a right hand side identifier?
And why does it matter?