.\" .\" UCSD p-System cross compiler .\" Copyright (C) 2006, 2007, 2012 Peter Miller .\" .\" This program is free software; you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by .\" the Free Software Foundation; either version 2 of the License, or (at .\" you option) any later version. .\" .\" This program is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU .\" General Public License for more details. .\" .\" You should have received a copy of the GNU General Public License along .\" with this program. If not, see .\" .ad l .hy 0 Compilers and Factories, 9
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?

.\" vim: set ts=8 sw=4 et :