Minimal programming language prototype, created with goal to have very small compiler, so that anyone can write his own compiler for it.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
985B

  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. integer a = 0;
  8. boolean b = 0;
  9. natural c = 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:
  20. x: integer = 1;
  21. loop (x++ < 101):
  22. if ((x % 3 = 0) && (x % 5 = 0))
  23. echo ("fizzbuzz\n");
  24. else if (x % 3 = 0):
  25. echo ("fizz\n");
  26. echo ("and again fizz\n");;
  27. else if (x % 5 = 0)
  28. echo ("buzz\n");
  29. else:
  30. echo ("fuck formatting...\n");
  31. echo ("fuck formatting twice...\n");;
  32. return (0);;
  33. string_length (character * text):
  34. length: natural = 0;
  35. loop (* (text + length++));
  36. return (length);;
  37. echo (character * text):
  38. system (linux_write_system_call, standard_output, text, string_length (text));
  39. return;;