|
- <!DOCTYPE html>
- <html>
- <meta charset="utf-8">
- <head>
- <link rel="stylesheet" href="../../style.css">
- </head>
- <body>
- <script data-goatcounter="https://services.opengamestudio.org:443/count" async src="//services.opengamestudio.org:443/count.js"></script>
- <div id="header">
- <div>
- <strong id="title">Open Game Studio</strong>
- <div id="lang">
- <a href="../../en/news/llm-first-py-cxx.html">EN</a>
- <a href="../../ru/news/llm-first-py-cxx.html">RU</a>
- </div>
- </div>
- <div class="header2">
- <div class="menu">
- <a href="../../en/news/index.html">News</a>
- <a href="../../en/game/index.html">Games</a>
- <a href="../../en/tool/index.html">Tools</a>
- <a href="../../en/page/about.html">About</a>
- </div>
- <a class="discord" href="https://discord.gg/3A6THQabNf">
- <img src="../../images/discord.png"></img>
- </a>
- <div class="clear"></div>
- </div>
- </div>
- <h3 class="left_item_title">In the news...</h3>
- <center>
- <div class="news_item">
- <h2 class="news_item_title">
- <a href="llm-first-py-cxx.html">The first example of a portable code</a>
- </h2>
- <p class="news_item_date">
- 2024-04-11 00:00
- </p>
- <div class="news_item_contents">
- <h1 id="supportedplatforms">Supported platforms</h1>
- <p>To verify code portability, I selected the following platforms and languages:</p>
- <ul>
- <li>C++: Linux, macOS, OpenWrt, Windows</li>
- <li>JavaScript: Chrome, Firefox, Safari</li>
- <li>Kotlin: Android</li>
- <li>Python: Linux, macOS, Windows</li>
- <li>Swift: iOS, macOS</li>
- </ul>
- <p>I created a simple "Hello World" example for each language to understand the basic requirements of each platform.</p>
- <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>
- <h1 id="anchorlanguageandlimitedlanguagemodel">Anchor language and limited language model</h1>
- <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>
- <p>Python is good because:</p>
- <ul>
- <li>one can specify a type with Type hints</li>
- <li>Python has portability across Linux, macOS, Windows out of the box</li>
- <li>pip simplifies distribution of the language conversion instrument</li>
- <li>Python does not require a separate compilation step, which speeds up development</li>
- </ul>
- <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>
- <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>
- <p><img src="../../images/2024_llm-first-py-cxx.jpg" alt="Python to C++ example" /></p>
- <h1 id="aprilplans">April plans</h1>
- <p>I'm going to write game logic for "Memory" in Python and convert it to C++ by the instrument under development.</p>
- </div>
- </div>
- <div id="disqus_thread"></div>
- <script>
- var disqus_config = function () {
- this.page.url = "https://opengamestudio.org/en/news/llm-first-py-cxx.html";
- this.page.identifier = "llm-first-py-cxx.html";
- };
- (function() { // DON'T EDIT BELOW THIS LINE
- var d = document, s = d.createElement('script');
- s.src = 'https://opengamestudio.disqus.com/embed.js';
- s.setAttribute('data-timestamp', +new Date());
- (d.head || d.body).appendChild(s);
- })();
- </script>
- <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
- <div id="footer">
- The site has been generated by <a href="http://opengamestudio.org/pskov">PSKOV</a>
- from <a href="http://github.com/ogstudio/site-opengamestudio">this source code</a>.
- </div>
- </center>
- </body>
- </html>
|