infixApp.js 350 B

123456789101112131415161718
  1. import { Expression } from './expression';
  2. export class InfixApp extends Expression {
  3. constructor(op, left, right) {
  4. super();
  5. this.op = op;
  6. this.left = left;
  7. this.right = right;
  8. }
  9. toString () {
  10. const l = this.left.toString();
  11. const op = this.op.value;
  12. const r = this.right.toString();
  13. return l + op + r;
  14. }
  15. }