<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sayan the researcher</title>
    <description>The latest articles on DEV Community by Sayan the researcher (@sayan9168).</description>
    <link>https://dev.to/sayan9168</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4089328%2Fa4f1cd53-7f27-419b-a6d5-4dd0e4ed640b.jpg</url>
      <title>DEV Community: Sayan the researcher</title>
      <link>https://dev.to/sayan9168</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sayan9168"/>
    <language>en</language>
    <item>
      <title>I Built a Self-Hosting Language, a DB Engine and a Microkernel — Entirely on My Phone</title>
      <dc:creator>Sayan the researcher</dc:creator>
      <pubDate>Sun, 30 Aug 2026 10:17:41 +0000</pubDate>
      <link>https://dev.to/sayan9168/i-built-a-self-hosting-language-a-db-engine-and-a-microkernel-entirely-on-my-phone-2edc</link>
      <guid>https://dev.to/sayan9168/i-built-a-self-hosting-language-a-db-engine-and-a-microkernel-entirely-on-my-phone-2edc</guid>
      <description>&lt;p&gt;No laptop. No IDE. Just Termux and a text editor.&lt;/p&gt;

&lt;p&gt;Over the past year I shipped five systems from my Android phone:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SahajCore — a self-hosting programming language&lt;/li&gt;
&lt;li&gt;SahajQL — a natural-language query language&lt;/li&gt;
&lt;li&gt;SahajDB / SahajGame / SahajOS — a DB engine, game engine, microkernel&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's how the core works.&lt;/p&gt;

&lt;h2&gt;
  
  
  SahajCore: source → machine
&lt;/h2&gt;

&lt;p&gt;The pipeline is classic:&lt;/p&gt;

&lt;p&gt;source → tokenizer → recursive-descent parser → AST&lt;br&gt;
       → tree-walk interpreter&lt;br&gt;
       → bytecode compiler → stack VM&lt;br&gt;
       → C / WAT transpilers&lt;/p&gt;

&lt;p&gt;The bytecode compiler emits a flat instruction list. This is real output&lt;br&gt;
from &lt;code&gt;sahajcore --compile&lt;/code&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0004 LOAD a
0005 LOAD b
0006 CONST 2
0007 BIN *
0008 BIN +
0009 STORE c
0014 BIN &amp;gt;
0015 JZ 19
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Self-hosting (the fun part)
&lt;/h2&gt;

&lt;p&gt;The interpreter is written in SahajCore itself. The bootstrap chain:&lt;/p&gt;

&lt;p&gt;Python-hosted interpreter&lt;br&gt;
  → runs selfhost.sahaj (interpreter written in SahajCore)&lt;br&gt;
    → runs target.sahaj (user program)&lt;/p&gt;

&lt;p&gt;The hardest bug: recursive Fibonacci blew the Python stack because every&lt;br&gt;
target-level call expanded into hundreds of host frames. Fix: rewrote the&lt;br&gt;
demo iteratively and raised the recursion limit.&lt;/p&gt;
&lt;h2&gt;
  
  
  Backends
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;C backend: emits C, compile with clang → native binary.&lt;/li&gt;
&lt;li&gt;WASM backend: emits WAT (i32 locals/params, stack ops), assemble with wat2wasm.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  SahajDB
&lt;/h2&gt;

&lt;p&gt;A tiny relational engine with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Write-Ahead Log (WAL) for durability&lt;/li&gt;
&lt;li&gt;Hash index on primary key&lt;/li&gt;
&lt;li&gt;commit() flushes to disk and clears the WAL&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Lessons
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Constraints focus you. A phone forces small, fast iterations.&lt;/li&gt;
&lt;li&gt;Write the interpreter in the language itself as early as possible.&lt;/li&gt;
&lt;li&gt;Test with real programs, not toy examples.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install sahajcore
pip install sahajql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;GitHub: github.com/sayan9168/SahajCore&lt;/p&gt;

&lt;p&gt;Happy to go deep on any part — ask me anything.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>python</category>
      <category>buildinpublic</category>
    </item>
  </channel>
</rss>
