#ifndef PROGRAM_H
#define PROGRAM_H

struct rule {
    int state;
    char read;
    char write;
    char move;
    int next;
};

class Program {
    class Item {
    public:
        rule data;
        Item *next;

        Item(const rule &r) : data(r), next(0) {}
    };

    Item *first;
    Item *last;

    // copying is forbidden
    Program(const Program &);
    void operator=(const Program &);

public:
    Program() : first(0), last(0) {}
    ~Program();

    bool Empty() const { return !first; }
    void Add(const rule &r);
    const rule *Find(int state, char symbol) const;
};

#endif
