Frumkin

My programming language compiled to C++

May 7th, 2021 (edited)
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. shared public define Run(...) {...}
  2.  
  3. shared public Bit Run(...) {...}
  4. shared public Bit* Run(...) {...}
  5.  
  6. shared public getter Bit Run(...) {...}
  7. shared public getter Bit* Run(...) {...}
  8.  
  9. shared public Function Run(...) = {...};
  10. shared public Function<Bit> Run(...) = {...};
  11. shared public Function<Bit*> Run(...) = {...};
  12.  
  13. shared public Bit(false) bit;
  14. shared public Bit* bitPointer = ref bit;
  15.  
  16. uniform public Bit(false) bit;
  17. uniform public Bit* bitPointer = ref bit;
  18.  
  19. public interface Textable {
  20. public Text ToText();
  21. }
  22.  
  23. public module Vector implements Textable {
  24. public Numeric(0.0) X;
  25. public Numeric(0.0) Y;
  26.  
  27. public construct(x: readonly Numeric*, y: readonly Numeric*) {
  28. X = val(x);
  29. Y = val(y);
  30. }
  31.  
  32. ToText() = {
  33. pass "X: " + X.ToText() + ", Y: " + Y.ToText();
  34. }
  35. }
  36.  
  37. shared public define Entry() {
  38. Vector(2.4, 8.7) vector;
  39.  
  40. Terminal.Log(ref vector);
  41. }
  42.  
  43.  
  44.  
  45.  
  46. // gets compiled to main.cpp:
  47.  
  48.  
  49.  
  50.  
  51. #include <iostream>
  52. #include <string>
  53. #include <vector>
  54. #include <functional>
  55.  
  56. public static void Run(...) {...}
  57.  
  58. public static bool Run(...) {...}
  59. public static bool* Run(...) {...}
  60.  
  61. public static bool Run(...) const {...}
  62. public static bool* Run(...) const {...}
  63.  
  64. public static std::function<void(...)> Run = [](...) {...};
  65. public static std::function<bool(...)> Run = [](...) {...};
  66. public static std::function<bool*(...)> Run = [](...) {...};
  67.  
  68. public static bool bit = false;
  69. public static bool* bitPointer = &bit;
  70.  
  71. public const bool bit = false;
  72. public const bool* const bitPointer = &bit;
  73.  
  74. public class Textable {
  75. public:
  76. virtual std::string ToText();
  77. }
  78.  
  79. public class Vector : public Textable {
  80. public:
  81. float X = 0.0f;
  82. float Y = 0.0f;
  83.  
  84. Vector(const float* x, const float* y) {
  85. X = *x;
  86. Y = *y;
  87. }
  88.  
  89. std::string ToText() {
  90. return "X: " + std::to_string(X) + ", Y: " + std::to_string(Y);
  91. }
  92. }
  93.  
  94.  
  95.  
  96. int main()
  97. {
  98. Vector vector(2.4f, 8.7f);
  99.  
  100. std::cout << vector.ToText() << std::endl;
  101. }
Add Comment
Please, Sign In to add comment