Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <iostream>
- #include <vector>
- using namespace std;
- class Combinator {
- public:
- virtual string show();
- };
- class Var : Combinator {
- public:
- Var(string name) : name(name) {}
- string name;
- string show() {
- return name;
- }
- };
- class App : Combinator {
- public:
- App(Combinator *m, Combinator *n) : m(m), n(n) {}
- Combinator *m, *n;
- string show() {
- return "(" + m->show() + n->show() + ")";
- }
- };
- class Lam : Combinator {
- public:
- Lam(Var *a, Combinator *n) : a(a), n(n) {}
- Var *a;
- Combinator *n;
- };
- string redex(Combinator *x) {
- if (typename(x))
- }
- int main() {
- string s;
- cin >> s;
- cout << redex(s) << "\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement