IterationIR.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef MANDEL_ITERATIONIR_H
  2. #define MANDEL_ITERATIONIR_H
  3. #include <string>
  4. #include <vector>
  5. #include "IterationFormula.h"
  6. #include "Arena.h"
  7. namespace mnd
  8. {
  9. namespace ir
  10. {
  11. struct Constant;
  12. struct Variable;
  13. struct Negation;
  14. struct BinaryOperation;
  15. struct Addition;
  16. struct Multiplication;
  17. using Node = std::variant<
  18. Constant,
  19. Variable,
  20. Negation,
  21. Addition,
  22. Multiplication
  23. >;
  24. class Formula
  25. {
  26. util::Arena<Node> nodeArena;
  27. Node* newA;
  28. Node* newB;
  29. };
  30. }
  31. ir::Formula expand(const mnd::IterationFormula& fmla);
  32. }
  33. struct mnd::ir::Constant
  34. {
  35. double value;
  36. };
  37. struct mnd::ir::Variable
  38. {
  39. std::string name;
  40. };
  41. struct mnd::ir::Negation
  42. {
  43. Node* value;
  44. };
  45. struct mnd::ir::BinaryOperation
  46. {
  47. Node* a;
  48. Node* b;
  49. };
  50. struct mnd::ir::Addition : mnd::ir::BinaryOperation
  51. {
  52. };
  53. struct mnd::ir::Multiplication : mnd::ir::BinaryOperation
  54. {
  55. };
  56. #endif // MANDEL_ITERATIONIR_H