您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

88 行
4.7KB

  1. <!DOCTYPE html>
  2. <html>
  3. <meta charset="utf-8">
  4. <head>
  5. <link rel="stylesheet" href="../../style.css">
  6. </head>
  7. <body>
  8. <script data-goatcounter="https://services.opengamestudio.org:443/count" async src="//services.opengamestudio.org:443/count.js"></script>
  9. <div id="header">
  10. <div>
  11. <strong id="title">Open Game Studio</strong>
  12. <div id="lang">
  13. <a href="../../en/news/llm-first-py-cxx.html">EN</a>
  14. <a href="../../ru/news/llm-first-py-cxx.html">RU</a>
  15. </div>
  16. </div>
  17. <div class="header2">
  18. <div class="menu">
  19. <a href="../../en/news/index.html">News</a>
  20. <a href="../../en/game/index.html">Games</a>
  21. <a href="../../en/tool/index.html">Tools</a>
  22. <a href="../../en/page/about.html">About</a>
  23. </div>
  24. <a class="discord" href="https://t.me/Tail_and_shadow">
  25. <img src="../../images/telegram.png"></img>
  26. </a>
  27. <div class="clear"></div>
  28. </div>
  29. </div>
  30. <h3 class="left_item_title">In the news...</h3>
  31. <center>
  32. <div class="news_item">
  33. <h2 class="news_item_title">
  34. <a href="llm-first-py-cxx.html">The first example of a portable code</a>
  35. </h2>
  36. <p class="news_item_date">
  37. 2024-04-11 00:00
  38. </p>
  39. <div class="news_item_contents">
  40. <h1 id="supportedplatforms">Supported platforms</h1>
  41. <p>To verify code portability, I selected the following platforms and languages:</p>
  42. <ul>
  43. <li>C++: Linux, macOS, OpenWrt, Windows</li>
  44. <li>JavaScript: Chrome, Firefox, Safari</li>
  45. <li>Kotlin: Android</li>
  46. <li>Python: Linux, macOS, Windows</li>
  47. <li>Swift: iOS, macOS</li>
  48. </ul>
  49. <p>I created a simple "Hello World" example for each language to understand the basic requirements of each platform.</p>
  50. <p>By the way, OpenWrt turned out the most complex platform to create "Hello World" for, because my TP-Link TL-MR3020 r1 router is considered obsolete since 2018. I had to use the old 17.01.7 firmware, which took about three weeks.</p>
  51. <h1 id="anchorlanguageandlimitedlanguagemodel">Anchor language and limited language model</h1>
  52. <p>For the whole month I was asking myself the same question: "Which language should I choose as a starting point to convert to other languages from?" Initial considerations were pointing me to C++ due to strong types. However, as soon as I found out Python has Type hints, I chose Python.</p>
  53. <p>Python is good because:</p>
  54. <ul>
  55. <li>one can specify a type with Type hints</li>
  56. <li>Python has portability across Linux, macOS, Windows out of the box</li>
  57. <li>pip simplifies distribution of the language conversion instrument</li>
  58. <li>Python does not require a separate compilation step, which speeds up development</li>
  59. </ul>
  60. <p>However, not every Python code will suite the language conversion instrument under development. Only the code that satisfies the constraints of the <code>Limited language model</code>.</p>
  61. <p>Limited language model is a subset of Python with various restrictions in both syntax and a set of available functions. Here is a glimpse of those restrictions, the image below depicts Python to C++ conversion result:</p>
  62. <p><img src="../../images/2024_llm-first-py-cxx.jpg" alt="Python to C++ example" /></p>
  63. <h1 id="aprilplans">April plans</h1>
  64. <p>I'm going to write game logic for "Memory" in Python and convert it to C++ by the instrument under development.</p>
  65. </div>
  66. </div>
  67. <div id="disqus_thread"></div>
  68. <script>
  69. var disqus_config = function () {
  70. this.page.url = "https://opengamestudio.org/en/news/llm-first-py-cxx.html";
  71. this.page.identifier = "llm-first-py-cxx.html";
  72. };
  73. (function() { // DON'T EDIT BELOW THIS LINE
  74. var d = document, s = d.createElement('script');
  75. s.src = 'https://opengamestudio.disqus.com/embed.js';
  76. s.setAttribute('data-timestamp', +new Date());
  77. (d.head || d.body).appendChild(s);
  78. })();
  79. </script>
  80. <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
  81. <div id="footer">
  82. The site has been generated by <a href="http://opengamestudio.org/pskov">PSKOV</a>
  83. from <a href="http://github.com/ogstudio/site-opengamestudio">this source code</a>.
  84. </div>
  85. </center>
  86. </body>
  87. </html>