<?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: Amine Yc</title>
    <description>The latest articles on DEV Community by Amine Yc (@diablon1).</description>
    <link>https://dev.to/diablon1</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1342596%2F440c0256-31bd-4579-a00b-03814fd8c7ed.png</url>
      <title>DEV Community: Amine Yc</title>
      <link>https://dev.to/diablon1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/diablon1"/>
    <language>en</language>
    <item>
      <title>How Building My Own Local Server Taught Me How JSON Parsing Actually Works (Lexer Parser Data Structure)</title>
      <dc:creator>Amine Yc</dc:creator>
      <pubDate>Fri, 22 May 2026 17:09:02 +0000</pubDate>
      <link>https://dev.to/diablon1/how-building-my-own-local-server-taught-me-how-json-parsing-actually-works-lexer-parser-data-3in4</link>
      <guid>https://dev.to/diablon1/how-building-my-own-local-server-taught-me-how-json-parsing-actually-works-lexer-parser-data-3in4</guid>
      <description>&lt;p&gt;I’m currently working on a local server project with an unusual constraint: &lt;strong&gt;I can only use standard libraries&lt;/strong&gt;. No external JSON packages, no helper parsing libraries, no frameworks doing the heavy lifting behind the scenes.&lt;/p&gt;

&lt;p&gt;At first, I thought:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"JSON is simple. It's just key-value text."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Then I started thinking about what actually happens when a server receives:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Amine"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"age"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"skills"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Go"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Java"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Networking"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How does a computer transform those characters into usable objects and values?&lt;/p&gt;

&lt;p&gt;How does text become structure?&lt;/p&gt;

&lt;p&gt;That question pushed me into learning something I had seen before but never really understood:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lexing&lt;/li&gt;
&lt;li&gt;Parsing&lt;/li&gt;
&lt;li&gt;Abstract structures&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This post isn't about implementation code. I'm still working on the project. Instead, this is the theoretical understanding I gained while building it.&lt;/p&gt;




&lt;h1&gt;
  
  
  The illusion of "simple text"
&lt;/h1&gt;

&lt;p&gt;Humans see JSON and immediately understand structure.&lt;/p&gt;

&lt;p&gt;We see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"John"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"age"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and our brains instantly think:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;object starts&lt;/li&gt;
&lt;li&gt;key = name&lt;/li&gt;
&lt;li&gt;value = John&lt;/li&gt;
&lt;li&gt;key = age&lt;/li&gt;
&lt;li&gt;value = 30&lt;/li&gt;
&lt;li&gt;object ends&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Computers do not think this way.&lt;/p&gt;

&lt;p&gt;To the machine, this initially looks closer to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
"
n
a
m
e
"
:
"
J
o
h
n
"
,
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Just individual characters.&lt;/p&gt;

&lt;p&gt;There is no "object."&lt;/p&gt;

&lt;p&gt;There is no "key."&lt;/p&gt;

&lt;p&gt;There is no "number."&lt;/p&gt;

&lt;p&gt;There is only a stream of symbols.&lt;/p&gt;

&lt;p&gt;The computer needs stages that gradually transform meaningless characters into meaningful structure.&lt;/p&gt;




&lt;h1&gt;
  
  
  Stage 1: Lexical analysis (tokenization)
&lt;/h1&gt;

&lt;p&gt;The first major step is the &lt;strong&gt;lexer&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A lexer scans raw characters and groups them into meaningful pieces called &lt;strong&gt;tokens&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Think of it as reading letters and turning them into words.&lt;/p&gt;

&lt;p&gt;Input:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"John"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"age"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output tokens:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LEFT_BRACE
STRING(name)
COLON
STRING(John)
COMMA
STRING(age)
COLON
NUMBER(30)
RIGHT_BRACE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice something important:&lt;/p&gt;

&lt;p&gt;The lexer does not care about relationships.&lt;/p&gt;

&lt;p&gt;It doesn't know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;whether &lt;code&gt;"name"&lt;/code&gt; is a key&lt;/li&gt;
&lt;li&gt;whether &lt;code&gt;30&lt;/code&gt; belongs to &lt;code&gt;"age"&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;whether the JSON structure is valid&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Its only job is:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"I see characters. I convert them into recognizable pieces."&lt;/em&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Why not skip the lexer?
&lt;/h1&gt;

&lt;p&gt;Originally I wondered:&lt;/p&gt;

&lt;p&gt;Why not directly parse characters?&lt;/p&gt;

&lt;p&gt;Why introduce another stage?&lt;/p&gt;

&lt;p&gt;I later realized that separating responsibilities makes everything simpler.&lt;/p&gt;

&lt;p&gt;Without a lexer:&lt;/p&gt;

&lt;p&gt;The parser would constantly need to think about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;whitespace&lt;/li&gt;
&lt;li&gt;escaped characters&lt;/li&gt;
&lt;li&gt;number formats&lt;/li&gt;
&lt;li&gt;commas&lt;/li&gt;
&lt;li&gt;quotation marks&lt;/li&gt;
&lt;li&gt;special symbols&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The parser would become messy.&lt;/p&gt;

&lt;p&gt;Instead:&lt;/p&gt;

&lt;p&gt;Lexer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Raw characters → Tokens
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Parser:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Tokens → Structure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each component has a single responsibility.&lt;/p&gt;




&lt;h1&gt;
  
  
  Stage 2: Parsing
&lt;/h1&gt;

&lt;p&gt;Once tokens exist, the parser begins building meaning.&lt;/p&gt;

&lt;p&gt;Suppose we have:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LEFT_BRACE
STRING(name)
COLON
STRING(John)
COMMA
STRING(age)
COLON
NUMBER(30)
RIGHT_BRACE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The parser now asks questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Did an object start?&lt;/li&gt;
&lt;li&gt;Is a string followed by a colon?&lt;/li&gt;
&lt;li&gt;Is there a value after the colon?&lt;/li&gt;
&lt;li&gt;Is a comma separating entries?&lt;/li&gt;
&lt;li&gt;Did the object end correctly?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The parser is essentially validating rules.&lt;/p&gt;

&lt;p&gt;JSON has a grammar.&lt;/p&gt;

&lt;p&gt;Simplified:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Object
    = { Members }

Members
    = Pair (, Pair)*

Pair
    = String : Value

Value
    = String
    | Number
    | Object
    | Array
    | true
    | false
    | null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The parser walks through tokens trying to satisfy these rules.&lt;/p&gt;




&lt;h1&gt;
  
  
  Parsing feels like reading a sentence
&lt;/h1&gt;

&lt;p&gt;I started seeing parsing as similar to language.&lt;/p&gt;

&lt;p&gt;Sentence:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The cat eats fish
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You unconsciously understand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"The cat" → subject&lt;/li&gt;
&lt;li&gt;"eats" → action&lt;/li&gt;
&lt;li&gt;"fish" → object&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You don't process individual letters.&lt;/p&gt;

&lt;p&gt;Your brain applies grammatical rules.&lt;/p&gt;

&lt;p&gt;Parsers do something similar.&lt;/p&gt;

&lt;p&gt;JSON:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"John"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;becomes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Object
    Pair
        Key = name
        Value = John
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Structure begins to emerge.&lt;/p&gt;




&lt;h1&gt;
  
  
  Nested objects changed my understanding completely
&lt;/h1&gt;

&lt;p&gt;Simple JSON is easy.&lt;/p&gt;

&lt;p&gt;Then nesting appears:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"John"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"skills"&lt;/span&gt;&lt;span class="p"&gt;:[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"Go"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"Java"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This suddenly becomes much more interesting.&lt;/p&gt;

&lt;p&gt;The parser cannot simply move left to right and forget previous information.&lt;/p&gt;

&lt;p&gt;When it sees:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;inside another object, it has to remember:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"I'm entering another level."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;means:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"Now I'm entering an array inside that object."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Then eventually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;means:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"Exit those levels."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The parser is constantly entering and leaving contexts.&lt;/p&gt;

&lt;p&gt;Almost like walking through rooms inside rooms.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;House
 └── Room
      └── Closet
           └── Box
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each opening symbol creates a new scope:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
[
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each closing symbol exits one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Trees started appearing everywhere
&lt;/h1&gt;

&lt;p&gt;While reading more, I kept finding the same idea:&lt;/p&gt;

&lt;p&gt;Everything becomes a tree.&lt;/p&gt;

&lt;p&gt;The JSON:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"John"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"skills"&lt;/span&gt;&lt;span class="p"&gt;:[&lt;/span&gt;&lt;span class="w"&gt;
         &lt;/span&gt;&lt;span class="s2"&gt;"Go"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
         &lt;/span&gt;&lt;span class="s2"&gt;"Java"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;can be imagined as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Object
|
+-- user
      |
      +-- Object
            |
            +-- name
            |      |
            |      +-- John
            |
            +-- skills
                    |
                    +-- Array
                           |
                           +-- Go
                           |
                           +-- Java
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I found this interesting because suddenly many things I had heard before started making more sense:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTML parsers&lt;/li&gt;
&lt;li&gt;compilers&lt;/li&gt;
&lt;li&gt;programming languages&lt;/li&gt;
&lt;li&gt;SQL parsers&lt;/li&gt;
&lt;li&gt;interpreters&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They all repeatedly convert:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Characters
    ↓
Tokens
    ↓
Structured representation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Different input.&lt;/p&gt;

&lt;p&gt;Same idea.&lt;/p&gt;




&lt;h1&gt;
  
  
  I finally understood what an AST is
&lt;/h1&gt;

&lt;p&gt;I had heard "AST" many times and thought it sounded complicated.&lt;/p&gt;

&lt;p&gt;AST means:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Abstract Syntax Tree&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The word "abstract" confused me initially.&lt;/p&gt;

&lt;p&gt;The idea is simpler than I expected.&lt;/p&gt;

&lt;p&gt;The tree keeps only meaningful information.&lt;/p&gt;

&lt;p&gt;Not unnecessary syntax.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"John"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The parser may encounter:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;commas&lt;/li&gt;
&lt;li&gt;braces&lt;/li&gt;
&lt;li&gt;quotation marks&lt;/li&gt;
&lt;li&gt;colons&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But the final structure cares about meaning:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Object
|
+-- name
      |
      +-- John
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The syntax symbols helped build the structure, but they are not necessarily part of the final representation.&lt;/p&gt;




&lt;h1&gt;
  
  
  Error handling suddenly became less mysterious
&lt;/h1&gt;

&lt;p&gt;Before learning this, parsing errors felt magical.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"John"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"age"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Missing comma.&lt;/p&gt;

&lt;p&gt;Humans instantly notice it.&lt;/p&gt;

&lt;p&gt;The parser notices because its grammar expected:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;STRING
COLON
VALUE
COMMA
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;but instead found:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;STRING
COLON
VALUE
STRING
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The sequence violated the rules.&lt;/p&gt;

&lt;p&gt;So parsing errors are not random.&lt;/p&gt;

&lt;p&gt;They're basically:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"I expected X, but found Y."&lt;/em&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  What surprised me the most
&lt;/h1&gt;

&lt;p&gt;I started this project trying to build a server.&lt;/p&gt;

&lt;p&gt;I expected to learn:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;sockets&lt;/li&gt;
&lt;li&gt;requests&lt;/li&gt;
&lt;li&gt;networking&lt;/li&gt;
&lt;li&gt;concurrency&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead, one of the biggest lessons became understanding how text becomes structured data.&lt;/p&gt;

&lt;p&gt;Now whenever I use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Unmarshal&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I no longer see magic.&lt;/p&gt;

&lt;p&gt;I imagine an invisible pipeline:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Raw text
     ↓
Characters
     ↓
Lexer
     ↓
Tokens
     ↓
Parser
     ↓
Tree/structure
     ↓
Objects and values
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before this project, JSON parsing felt like a built-in feature.&lt;/p&gt;

&lt;p&gt;Now it feels more like a series of small, logical transformations.&lt;/p&gt;

&lt;p&gt;And I think that's one of the most interesting things about building systems from scratch:&lt;/p&gt;

&lt;p&gt;sometimes you start building one thing and end up understanding an entirely different layer of computing.&lt;/p&gt;




&lt;p&gt;I'm still working on this local server project, and I'm still learning, but understanding the theory behind lexing and parsing changed how I look at data processing entirely.&lt;/p&gt;

&lt;p&gt;Have you ever started a project for one reason and ended up learning something completely unexpected?&lt;/p&gt;

</description>
      <category>backend</category>
      <category>computerscience</category>
      <category>learning</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
