Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <string>
  2. #include <iostream>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. class Combinator {
  8. public:
  9.     virtual string show();
  10. };
  11.  
  12. class Var : Combinator {
  13. public:
  14.     Var(string name) : name(name) {}
  15.     string name;
  16.     string show() {
  17.         return name;
  18.     }
  19. };
  20.  
  21. class App : Combinator {
  22. public:
  23.     App(Combinator *m, Combinator *n) : m(m), n(n) {}
  24.     Combinator *m, *n;
  25.     string show() {
  26.         return "(" + m->show() + n->show() + ")";
  27.     }
  28. };
  29.  
  30. class Lam : Combinator {
  31. public:
  32.     Lam(Var *a, Combinator *n) : a(a), n(n) {}
  33.     Var *a;
  34.     Combinator *n;
  35. };
  36.  
  37. string redex(Combinator *x) {
  38.     if (typename(x))
  39. }
  40.  
  41. int main() {
  42.     string s;
  43.     cin >> s;
  44.     cout << redex(s) << "\n";
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement