Minimal programming language prototype, created with goal to have very small compiler, so that anyone can write his own compiler for it.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

55 lines
1.1KB

  1. --- Heyo
  2. type boolean (false, true)
  3. type character = -128 .. 127;
  4. type integer = -2000000000 .. 2000000000;
  5. type natural % 2000000000;
  6. type structure (
  7. a: integer = 0;
  8. b: boolean = false;
  9. c: natural = 0)
  10. type system_call (
  11. linux_read_system_call = 0,
  12. linux_write_system_call = 1,
  13. linux_open_system_call = 2,
  14. linux_close_system_call = 3,
  15. linux_exit_system_call = 60)
  16. type file_descriptor (
  17. standard_input = 0,
  18. standard_output = 1)
  19. main () > integer:
  20. x: integer = 1;
  21. s: structure = (-1, true, 1);
  22. loop (x++ < 101):
  23. if ((x % 3 = 0) && (x % 5 = 0))
  24. echo ("fizzbuzz");
  25. else if (x % 3 = 0):
  26. echo ("fizz\n");
  27. echo ("and again fizz");;
  28. else if (x % 5 = 0)
  29. echo ("buzz\n");
  30. else:
  31. echo ("fuck formatting...");
  32. echo ("fuck formatting twice...");;
  33. echo ("\n");;
  34. return (0);;
  35. heyo () echo ("Heyo!");
  36. cyaa () echo ("Heyo!");
  37. name () > characer [] return ("Ognjen");
  38. string_length (character string []) > natural:
  39. length: natural = 0;
  40. loop (! string [length])
  41. length++;
  42. return (length);;
  43. echo (character text []):
  44. system (linux_write_system_call, standard_output, text, string_length (text));
  45. return;;