I'm currently working on a recursive descent interpreter using C++. Though there is already a code on the project, I'm asked to rewrite the Recursive Descent Interpreter implementing it using a list class without using templates and facilites from the standard template library. I already worked through part of the code and I'm having a bit of trouble with finding a solution to an error. Here's the code.

//**************************  interpreter.cpp   ***********************

#include <cctype>
#include "interpreter.h"

Iterator list :: begin()
{
         
}

Iterator list :: end()
{
         
}

Iterator list :: push_front()
{
         
}

double Statement::findValue(char *id) {
    IdNode tmp(id);
    list::iterator i = find(idList.begin(),idList.end(),tmp);
    if (i != idList.end())
         return i->value;
    else issueError("Unknown variable");
    return 0;  // this statement will never be reached;
}

void Statement::processNode(char* id ,double e) {
    IdNode tmp(id,e);
    list::iterator i = find(idList.begin(),idList.end(),tmp);
    if (i != idList.end())
         i->value = e;
    else idList.push_front(tmp);
}

// readId() reads strings of letters and digits that start with
// a letter, and stores them in array passed to it as an actual
// parameter. 
// Examples of identifiers are: var1, x, pqr123xyz, aName, etc.

void Statement::readId(char *id) {
    int i = 0;
    if (isspace(ch))
         cin >> ch;       // skip blanks;
    if (isalpha(ch)) {
         while (isalnum(ch)) {
             id[i++] = ch;
             cin.get(ch); // don't skip blanks;
         }
         id[i] = '\0';
    }
    else issueError("Identifier expected");
}

double Statement::factor() {
    double var, minus = 1.0;
    static char id[200];
    cin >> ch;
    while (ch == '+' || ch == '-') {      // take all '+'s and '-'s.
        if (ch == '-')
            minus *= -1.0;
        cin >> ch;
    }
    if (isdigit(ch) || ch == '.') {      // Factor can be a number
         cin.putback(ch);
         cin >> var >> ch;
    }
    else if (ch == '(') {                  // or a parenthesized expression,
         var = expression();
         if (ch == ')')
              cin >> ch;
         else issueError("Right paren left out");
    }
    else {
         readId(id);                          // or an identifier.
         if (isspace(ch))
             cin >> ch;
         var = findValue(id);
    }
    return minus * var;
}

double Statement::term() {
    double f = factor();
    while (true) {
        switch (ch) {
            case '*' : f *= factor(); break;
            case '/' : f /= factor(); break;
            default  : return f;
        }
    }
}

double Statement::expression() {
    double t = term();
    while (true) {
        switch (ch) {
            case '+' : t += term(); break;
            case '-' : t -= term(); break;
            default  : return t;
        }
    }
}

void Statement::getStatement() {
    char id[20], command[20];
    double e;
    cout << "Enter a statement: ";
    cin  >> ch;
    readId(id);
    strcpy(command,id);
    for (int i = 0; i < strlen(command); i++)
	command[i] = toupper(command[i]);
    if (strcmp(command,"STATUS") == 0)
         cout << *this;
    else if (strcmp(command,"PRINT") == 0) {
         readId(id);
         cout << id << " = " << findValue(id) << endl;
    }
    else if (strcmp(command,"END") == 0)
         exit(0);
    else {
         if (isspace(ch))
             cin >> ch;
         if (ch == '=') {
              e = expression();
              if (ch != ';')
                   issueError("There are some extras in the statement");
              else processNode(id,e);
         }
         else issueError("'=' is missing");
    }
}
//**************************  interpreter.h   ***********************

#ifndef INTERPRETER
#define INTERPRETER

#include <iostream>

//#include <list>
//#include <algorithm> // find()

using namespace std;

class IdNode {
public:
    IdNode(char *s = "", double e = 0) {
        id = strdup(s);
        value = e;
    }
    bool operator== (const IdNode& node) const {
        return strcmp(id,node.id) == 0;
    }
 
private:
    char *id;
    double value;
    friend class Statement;
    friend ostream& operator<< (ostream& out, const IdNode& r) {
        out << r.id << " = " << r.value << endl;
        return out;
    }
};


class Iterator
{
      public:
      IdNode *node;
      Iterator &operator ++ (int);
      IdNode &operator * ();
      IdNode *operator -> ();
      bool operator != (bool);

};

class list
{
      IdNode *head, *tail;
      public:
             typedef Iterator iterator;
             typedef Iterator const_iterator;
             Iterator begin ();
             Iterator end ();
             Iterator push_front ();
             
};

class Statement {
public:
    Statement() { 
    }
    void getStatement();
private:
    IdNode idList;
    char  ch;
    double factor();
    double term();
    double expression();
    void readId(char*);
    void issueError(char *s) { 
        cerr << s << endl; exit(1); 
    }
    double findValue(char*);
    void  processNode(char*, double);
    friend ostream& operator<< (ostream& out, const Statement& s) {
        list::const_iterator i = s.idList.begin();
        for ( ; i != s.idList.end(); i++)
            out << *i;
        out << endl;
        return out;
    }
};

#endif
//**************************  useInterpreter.cpp   ***********************

#include "interpreter.h"


int main() {
    Statement statement;
    cout << "The program processes statements of the following format:\n"
         << "\t<id> = <expr>;\n\tprint <id>\n\tstatus\n\tend\n\n";
    while (true)                  // This infinite loop is broken by exit(1)
        statement.getStatement(); // in getStatement() or upon finding 
    return 0;                     // an error.
}

The errors are that IdNode has no member named 'end', 'begin' and 'push_front'. Help guys. Thanks.

>The errors are that IdNode has no member named 'end', 'begin' and 'push_front'. Help guys.
The errors are correct. IdNode indeed has no member named end, begin, or push_front. Your list class does though, so you probably wanted idList to be an object of the list class rather than the IdNode class.

Hello, im a friend of starpointer123 and both of us have been working on this project for the past weeks. I have already tried chainging the

IdNode Idlist

to just

list Idlist

However, other errors such as

In member function `void Statement::processNode(char*, double)': 
 no matching function to call `list::begin()'

this is because the member function

Iterator begin();

in the class function was changed into

Iterator begin(const string&);

to solve the error when implementing

Iterator list :: begin()

and other member functions in the list class.
I solved the errors by replacing

list::begin()

to

list::begin(const string&)

as it is a candidate solution provided the compiler.
New error messages arises from this solution. The new error message is now

expected primary-expression before "const"

Now we do not know what 'primary-expression' we should put befor 'const'.

Our new source codes are these:

//**************************  interpreter.cpp   ***********************

#include <cctype>
#include "interpreter.h"

Iterator list :: begin(const string& h)
{
              if(empty())
    {
       IdNode* temp = new IdNode;
       head = temp;
       tail = temp;
       temp->prev = NULL;
       temp->next = NULL;
       temp->element = h;
    }
    else
    {
       IdNode* curr;
       curr = tail;
       while( h>curr->element && curr->prev != head->prev) curr = curr->prev;

       if(curr == tail)
       {
         IdNode* temp = new IdNode;
         temp->element = h;
         temp->next = curr;
         temp->prev = NULL;
         head->prev = temp;
         head = temp;
     
       }
       else
       {
       if(curr == head && h>head->element)
       {
         head->prev = new IdNode;
         (head->prev)->next = head;
         head = head->prev;
         head->prev = NULL;
         head->element = h;
      
       }
       else
       {
         IdNode* temp = new IdNode;
         temp->element = h;
         temp->prev = curr;
         (curr->next)->prev = temp;
         temp->next = curr->next;
         curr->next = temp;
      
       }
      }
    }
}

Iterator list :: end(const string& t)
{
         if(empty())
    {
       IdNode* temp = new IdNode;
       head = temp;
       tail = temp;
       temp->prev = NULL;
       temp->next = NULL;
       temp->element = t;
    }
    else
    {
       IdNode* curr;
       curr = head;
       while( t>curr->element && curr->next != tail->next) curr = curr->next;

       if(curr == head)
       {
         IdNode* temp = new IdNode;
         temp->element = t;
         temp->prev = curr;
         temp->next = NULL;
         head->next = temp;
         tail = temp;
     
       }
       else
       {
       if(curr == tail && t>tail->element)
       {
         tail->next = new IdNode;
         (tail->next)->prev = tail;
         tail = tail->next;
         tail->next = NULL;
         tail->element = t;
     
       }
       else
       {
         IdNode* temp = new IdNode;
         temp->element = t;
         temp->next = curr;
         (curr->prev)->next = temp;
         temp->prev = curr->prev;
         curr->prev = temp;
      
       }
      }
    }
}

Iterator list :: push_front()
{
}

double Statement::findValue(char *id) {
    IdNode tmp(id);
    list::iterator i = find(idList.begin(const string&),idList.end(const string&),tmp);
    if (i != idList.end(const string&))
         return i->value;
    else issueError("Unknown variable");
    return 0;  // this statement will never be reached;
}

void Statement::processNode(char* id ,double e) {
    IdNode tmp(id,e);
    list::iterator i = find(idList.begin(const string&),idList.end(const string&),tmp);
    if (i != idList.end(const string&))
    i->value = e;
    else idList.push_front();
}

// readId() reads strings of letters and digits that start with
// a letter, and stores them in array passed to it as an actual
// parameter. 
// Examples of identifiers are: var1, x, pqr123xyz, aName, etc.

void Statement::readId(char *id) {
    int i = 0;
    if (isspace(ch))
         cin >> ch;       // skip blanks;
    if (isalpha(ch)) {
         while (isalnum(ch)) {
             id[i++] = ch;
             cin.get(ch); // don't skip blanks;
         }
         id[i] = '\0';
    }
    else issueError("Identifier expected");
}

double Statement::factor() {
    double var, minus = 1.0;
    static char id[200];
    cin >> ch;
    while (ch == '+' || ch == '-') {      // take all '+'s and '-'s.
        if (ch == '-')
            minus *= -1.0;
        cin >> ch;
    }
    if (isdigit(ch) || ch == '.') {      // Factor can be a number
         cin.putback(ch);
         cin >> var >> ch;
    }
    else if (ch == '(') {                  // or a parenthesized expression,
         var = expression();
         if (ch == ')')
              cin >> ch;
         else issueError("Right paren left out");
    }
    else {
         readId(id);                          // or an identifier.
         if (isspace(ch))
             cin >> ch;
         var = findValue(id);
    }
    return minus * var;
}

double Statement::term() {
    double f = factor();
    while (true) {
        switch (ch) {
            case '*' : f *= factor(); break;
            case '/' : f /= factor(); break;
            default  : return f;
        }
    }
}

double Statement::expression() {
    double t = term();
    while (true) {
        switch (ch) {
            case '+' : t += term(); break;
            case '-' : t -= term(); break;
            default  : return t;
        }
    }
}

void Statement::getStatement() {
    char id[20], command[20];
    double e;
    cout << "Enter a statement: ";
    cin  >> ch;
    readId(id);
    strcpy(command,id);
    for (int i = 0; i < strlen(command); i++)
	command[i] = toupper(command[i]);
    if (strcmp(command,"STATUS") == 0)
         cout << *this;
    else if (strcmp(command,"PRINT") == 0) {
         readId(id);
         cout << id << " = " << findValue(id) << endl;
    }
    else if (strcmp(command,"END") == 0)
         exit(0);
    else {
         if (isspace(ch))
             cin >> ch;
         if (ch == '=') {
              e = expression();
              if (ch != ';')
                   issueError("There are some extras in the statement");
              else processNode(id,e);
         }
         else issueError("'=' is missing");
    }
}
//**************************  interpreter.h   ***********************

#ifndef INTERPRETER
#define INTERPRETER

#include <iostream>

//#include <list>
//#include <algorithm> // find()

using namespace std;

class IdNode {
public:
    IdNode(char *s = "", double e = 0) {
        id = strdup(s);
        value = e;
    }
    bool operator== (const IdNode& node) const {
        return strcmp(id,node.id) == 0;
    }
    IdNode *prev;
    IdNode *next;
    string element;

  
private:   
    char *id;
    double value;
    friend class Statement;
    friend ostream& operator<< (ostream& out, const IdNode& r) {
        out << r.id << " = " << r.value << endl;
        return out;
    }
};

class Iterator
{
      public:
      IdNode *node;
      Iterator &operator ++ (int);
      IdNode &operator * ();
      IdNode *operator -> ();
      bool operator != (bool);

};

class list
{
      IdNode *head, *tail;
      public:
             typedef Iterator iterator;
             typedef Iterator const_iterator;
             Iterator begin (const string&);
             Iterator end (const string&);
             Iterator push_front ();
             bool empty() const { return head==NULL; }
             
};



class Statement {
public:
    Statement() { 
    }
    void getStatement();
private:
    list idList;
    char  ch;
    double factor();
    double term();
    double expression();
    void readId(char*);
    void issueError(char *s) { 
        cerr << s << endl; exit(1); 
    }
    double findValue(char*);
    void  processNode(char*, double);
    friend ostream& operator<< (ostream& out, Statement& s) {
        list::const_iterator i = s.idList.begin(const string&);
        for ( ; i != s.idList.end(const string&); i++)
        out << *i;
        out << endl;
        return out;
    }
};

#endif

no changes have been done to useInterpreter.cpp

Edited 6 Years Ago by shadow29014: n/a

Ok, we've made some progress regarding our earlier problems but still one error persists. Here's the new code followed by the error.

//**************************  interpreter.cpp   ***********************

#include <cctype>
#include "interpreter.h"

Iterator list :: begin()
{
iterator temp;
temp.node = head;
return temp;
}

Iterator list :: end()
{
iterator temp;
temp.node = tail;
return temp;
}

Iterator list :: push_front()
{
iterator temp;
head = temp->next;
temp.node = head;
return temp;
}


double Statement::findValue(char *id) {
    IdNode tmp(id);
    list::iterator i = find(idList.begin(),idList.end(),tmp);
    if (i != idList.end())
    return i->value;
    else issueError("Unknown variable");
    return 0;  // this statement will never be reached;
}

void Statement::processNode(char* id ,double e) {
    IdNode tmp(id,e);
    list::iterator i = find(idList.begin(),idList.end(),tmp);
    if (i != idList.end())
    i->value = e;
    else idList.push_front();
}

// readId() reads strings of letters and digits that start with
// a letter, and stores them in array passed to it as an actual
// parameter. 
// Examples of identifiers are: var1, x, pqr123xyz, aName, etc.

void Statement::readId(char *id) {
    int i = 0;
    if (isspace(ch))
         cin >> ch;       // skip blanks;
    if (isalpha(ch)) {
         while (isalnum(ch)) {
             id[i++] = ch;
             cin.get(ch); // don't skip blanks;
         }
         id[i] = '\0';
    }
    else issueError("Identifier expected");
}

double Statement::factor() {
    double var, minus = 1.0;
    static char id[200];
    cin >> ch;
    while (ch == '+' || ch == '-') {      // take all '+'s and '-'s.
        if (ch == '-')
            minus *= -1.0;
        cin >> ch;
    }
    if (isdigit(ch) || ch == '.') {      // Factor can be a number
         cin.putback(ch);
         cin >> var >> ch;
    }
    else if (ch == '(') {                  // or a parenthesized expression,
         var = expression();
         if (ch == ')')
              cin >> ch;
         else issueError("Right paren left out");
    }
    else {
         readId(id);                          // or an identifier.
         if (isspace(ch))
             cin >> ch;
         var = findValue(id);
    }
    return minus * var;
}

double Statement::term() {
    double f = factor();
    while (true) {
        switch (ch) {
            case '*' : f *= factor(); break;
            case '/' : f /= factor(); break;
            default  : return f;
        }
    }
}

double Statement::expression() {
    double t = term();
    while (true) {
        switch (ch) {
            case '+' : t += term(); break;
            case '-' : t -= term(); break;
            default  : return t;
        }
    }
}

void Statement::getStatement() {
    char id[20], command[20];
    double e;
    cout << "Enter a statement: ";
    cin  >> ch;
    readId(id);
    strcpy(command,id);
    for (int i = 0; i < strlen(command); i++)
	command[i] = toupper(command[i]);
    if (strcmp(command,"STATUS") == 0)
         cout << *this;
    else if (strcmp(command,"PRINT") == 0) {
         readId(id);
         cout << id << " = " << findValue(id) << endl;
    }
    else if (strcmp(command,"END") == 0)
         exit(0);
    else {
         if (isspace(ch))
             cin >> ch;
         if (ch == '=') {
              e = expression();
              if (ch != ';')
                   issueError("There are some extras in the statement");
              else processNode(id,e);
         }
         else issueError("'=' is missing");
    }
}
//**************************  interpreter.h   ***********************

#ifndef INTERPRETER
#define INTERPRETER

#include <iostream>

//#include <list>
#include <algorithm> // find()

using namespace std;

class IdNode {
public:
    IdNode(char *s = "", double e = 0) {
        id = strdup(s);
        value = e;
    }
    bool operator== (const IdNode& node) const {
        return strcmp(id,node.id) == 0;
    }
    IdNode *prev;
    IdNode *next;
    string element;

  
private:   
    char *id;
    double value;
    friend class Statement;
    friend ostream& operator<< (ostream& out, const IdNode& r) {
        out << r.id << " = " << r.value << endl;
        return out;
    }
};

class Iterator
{
      public:
      IdNode *node;
      Iterator &operator ++ ();
      IdNode &operator * ();
      IdNode *operator -> ();
      bool operator != (const Iterator&);
      
      typedef ptrdiff_t                     difference_type;  
      typedef bidirectional_iterator_tag    iterator_category;  
      typedef IdNode                           value_type;  
      typedef IdNode*                          pointer;  
      typedef IdNode&                          reference;    
      
      reference operator*() const;
      pointer operator->() const;
      Iterator& operator--();
      Iterator operator--(int);
      Iterator& operator++();
      Iterator operator++(int);
      bool operator==(const Iterator& __x) const;
      bool operator!=(const Iterator& __x) const;

};

class list
{
      IdNode *head, *tail;
      public:
             typedef Iterator iterator;
             typedef Iterator const_iterator;
             Iterator begin ();
             Iterator end ();
             Iterator push_front ();
             bool empty() const { return head==NULL; }
                       
};



class Statement {
public:
    Statement() { 
    }
    void getStatement();
private:
    list idList;
    char  ch;
    double factor();
    double term();
    double expression();
    void readId(char*);
    void issueError(char *s) { 
        cerr << s << endl; exit(1); 
    }
    double findValue(char*);
    void  processNode(char*, double);
    friend ostream& operator<< (ostream& out, Statement& s) {
        list::const_iterator i = s.idList.begin();
        for ( ; i != s.idList.end(); i++)
        out << *i;
        out << endl;
        return out;
    }
};

#endif
//**************************  useInterpreter.cpp   ***********************

#include "interpreter.h"


int main() {
    Statement statement;
    cout << "The program processes statements of the following format:\n"
         << "\t<id> = <expr>;\n\tprint <id>\n\tstatus\n\tend\n\n";
    while (true)                  // This infinite loop is broken by exit(1)
        statement.getStatement(); // in getStatement() or upon finding 
    return 0;                     // an error.
}

The error Message:

Line 4 In file included from interpreter.cpp
Line 56 'Iterator& Iterator::operator++()' and 'Iterator& Iterator::operator++()' cannot be overloaded
[Build Error] [interpreter.o] Error 1

Any ideas on how to solve this?
Really need help here.

You are declaring the function 'Iterator& operator++()' twice, once on line 41 and again on line 56. Since they have the same signature, there is no way for the compiler to disambiguate the two versions (which were probably not intentional anyway), so it gives an error.

There's a new code and it compiles but it doesn't seem to function properly. There are some parts in the code (lines 49-71 in interpreter.h)

Here's the new code

//**************************  interpreter.cpp   ***********************

#include <cctype>
#include "interpreter.h"

Iterator list :: begin()
{
iterator temp;
temp.node = head;
return temp;
}

Iterator list :: end()
{
  iterator temp;
  temp.node = tail;
  return temp;
}

Iterator list :: push_front()
{
  iterator temp;  
  head = temp->next;  
  temp.node = head;  
  return temp; 
}

double Statement::findValue(char *id) {
    IdNode tmp(id);
    list::iterator i = find(idList.begin(),idList.end(),tmp);
    if (i != idList.end())
    return i->value;
    else issueError("Unknown variable");
    return 0;  // this statement will never be reached;
}

void Statement::processNode(char* id ,double e) {
    IdNode tmp(id,e);
    list::iterator i = find(idList.begin(),idList.end(),tmp);
    if (i != idList.end())
    i->value = e;
    else idList.push_front();
}

// readId() reads strings of letters and digits that start with
// a letter, and stores them in array passed to it as an actual
// parameter. 
// Examples of identifiers are: var1, x, pqr123xyz, aName, etc.

void Statement::readId(char *id) {
    int i = 0;
    if (isspace(ch))
         cin >> ch;       // skip blanks;
    if (isalpha(ch)) {
         while (isalnum(ch)) {
             id[i++] = ch;
             cin.get(ch); // don't skip blanks;
         }
         id[i] = '\0';
    }
    else issueError("Identifier expected");
}

double Statement::factor() {
    double var, minus = 1.0;
    static char id[200];
    cin >> ch;
    while (ch == '+' || ch == '-') {      // take all '+'s and '-'s.
        if (ch == '-')
            minus *= -1.0;
        cin >> ch;
    }
    if (isdigit(ch) || ch == '.') {      // Factor can be a number
         cin.putback(ch);
         cin >> var >> ch;
    }
    else if (ch == '(') {                  // or a parenthesized expression,
         var = expression();
         if (ch == ')')
              cin >> ch;
         else issueError("Right paren left out");
    }
    else {
         readId(id);                          // or an identifier.
         if (isspace(ch))
             cin >> ch;
         var = findValue(id);
    }
    return minus * var;
}

double Statement::term() {
    double f = factor();
    while (true) {
        switch (ch) {
            case '*' : f *= factor(); break;
            case '/' : f /= factor(); break;
            default  : return f;
        }
    }
}

double Statement::expression() {
    double t = term();
    while (true) {
        switch (ch) {
            case '+' : t += term(); break;
            case '-' : t -= term(); break;
            default  : return t;
        }
    }
}

void Statement::getStatement() {
    char id[20], command[20];
    double e;
    cout << "Enter a statement: ";
    cin  >> ch;
    readId(id);
    strcpy(command,id);
    for (int i = 0; i < strlen(command); i++)
	command[i] = toupper(command[i]);
    if (strcmp(command,"STATUS") == 0)
         cout << *this;
    else if (strcmp(command,"PRINT") == 0) {
         readId(id);
         cout << id << " = " << findValue(id) << endl;
    }
    else if (strcmp(command,"END") == 0)
         exit(0);
    else {
         if (isspace(ch))
             cin >> ch;
         if (ch == '=') {
              e = expression();
              if (ch != ';')
                   issueError("There are some extras in the statement");
              else processNode(id,e);
         }
         else issueError("'=' is missing");
    }
}
//**************************  interpreter.h   ***********************

#ifndef INTERPRETER
#define INTERPRETER

#include <iostream>

//#include <list>
#include <algorithm> // find()

using namespace std;

class IdNode {
public:
    IdNode(char *s = "", double e = 0) {
        id = strdup(s);
        value = e;
    }
    bool operator== (const IdNode& node) const {
        return strcmp(id,node.id) == 0;
    }
    IdNode *prev;
    IdNode *next;
    string element;

  
private:   
    char *id;
    double value;
    friend class Statement;
    friend ostream& operator<< (ostream& out, const IdNode& r) {
        out << r.id << " = " << r.value << endl;
        return out;
    }
};

class Iterator
{
      public:
      IdNode *node;
      
      typedef ptrdiff_t                     difference_type;  
      typedef bidirectional_iterator_tag    iterator_category;  
      typedef IdNode                           value_type;  
      typedef IdNode*                          pointer;  
      typedef IdNode&                          reference;    
      
    reference operator*() const
    {
    }
    pointer operator->() const
    {
    }
    Iterator& operator++()
    {
    }
    Iterator operator++(int)
    {
    }
    Iterator& operator--()
    {
    }
    Iterator operator--(int)
    {
    }
    bool operator==(const Iterator&) const
    {
    }
    bool operator!=(const Iterator&) const
    {
    }  
      
      
};

class list
{
      IdNode *head, *tail;
      public:
             typedef Iterator iterator;
             typedef Iterator const_iterator;
             Iterator begin ();
             Iterator end ();
             Iterator push_front ();
             bool empty() const { return head==NULL; }
                       
};



class Statement {
public:
    Statement() { 
    }
    void getStatement();
private:
    list idList;
    char  ch;
    double factor();
    double term();
    double expression();
    void readId(char*);
    void issueError(char *s) { 
        cerr << s << endl; exit(1); 
    }
    double findValue(char*);
    void  processNode(char*, double);
    friend ostream& operator<< (ostream& out, Statement& s) {
        list::const_iterator i = s.idList.begin();
        for ( ; i != s.idList.end(); ++i)
        out << *i;
        out << endl;
        return out;
    }
};

#endif
//**************************  useInterpreter.cpp   ***********************

#include "interpreter.h"


int main() {
    Statement statement;
    cout << "The program processes statements of the following format:\n"
         << "\t<id> = <expr>;\n\tprint <id>\n\tstatus\n\tend\n\n";
    while (true)                  // This infinite loop is broken by exit(1)
        statement.getStatement(); // in getStatement() or upon finding 
    return 0;                     // an error.
}

help?

thanks.

Edited 6 Years Ago by starpointer123: n/a

This question has already been answered. Start a new discussion instead.