Minimal programming language prototype, created with goal to have very small compiler, so that anyone can write his own compiler for it.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

53 行
1.1KB

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