<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Athar Qadri</title><description>Personal essays on craft, focus and the subtleties. Written slowly, published rarely.</description><link>https://www.atharqadri.com/</link><language>en</language><item><title>Building Finlang: A Language Server for Finacle Scripts</title><link>https://www.atharqadri.com/posts/building-finlang/</link><guid isPermaLink="true">https://www.atharqadri.com/posts/building-finlang/</guid><description>How we designed and implemented an LSP server that brings diagnostics, hover documentation, and completion to Finacle scripts.</description><pubDate>Wed, 21 Oct 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;The problem was simple: Finacle scripts are hard to check until they run, and the gap between writing one and trusting one is uncomfortable.&lt;/p&gt;
&lt;p&gt;A stray quote, an &lt;code&gt;ENDIF&lt;/code&gt; that never arrives, or a repository variable that was never initialized all look plausible in an editor. The mistake only becomes obvious when the script finds its way into production, usually after a deploy, usually while someone is waiting for a banking transaction to complete. The runtime is less forgiving. The feedback loop has become expensive.&lt;/p&gt;
&lt;p&gt;We built &lt;strong&gt;Finlang&lt;/strong&gt; to bring that feedback into the editor. It provides live diagnostics, hover documentation, completion for Finacle keywords and &lt;code&gt;urhk_*&lt;/code&gt; functions, and a limited amount of cross-file awareness for scripts invoked through &lt;code&gt;CALL(...)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It is not a Finacle compiler. It is a practical language server: a set of checks we trust enough to keep turned on, backed by a protocol that lets the same engine work in more than one editor.&lt;/p&gt;
&lt;p&gt;This is how we built it, what we changed our minds about and where we drew the line.&lt;/p&gt;
&lt;h2&gt;Why we didn&apos;t write a Vim plugin&lt;/h2&gt;
&lt;p&gt;The obvious first move is an editor plugin. That is where the developer already is and it avoids inventing a protocol.&lt;/p&gt;
&lt;p&gt;The problem is that language intelligence is the expensive part. Parsing, diagnostics, document state, symbol lookup, and documentation are not editor-specific, but a plugin makes them editor-specific anyway. Every editor then needs its own version of the same work. With enough editors and enough languages, you get an N × M maintenance problem.&lt;/p&gt;
&lt;p&gt;The Language Server Protocol turns that into N + M. Each editor implements the client side once. Each language implements the server side once. Microsoft introduced LSP&lt;sup&gt;&lt;a href=&quot;#fn1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt; in 2016, and it is now supported by VS Code, Neovim, Vim, Emacs, Sublime Text, and others.&lt;/p&gt;
&lt;p&gt;For us, that was not an abstract architectural preference. It gave us four concrete things:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;One place to encode language rules.&lt;/strong&gt; The same diagnostics run in every editor, so a rule cannot drift between clients.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A shorter feedback loop.&lt;/strong&gt; Errors appear while typing instead of after a deploy.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A testable boundary.&lt;/strong&gt; The linter has a plain Python interface. We can test it without launching an editor.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Room to grow.&lt;/strong&gt; We shipped diagnostics first, then hover and completion. None of those required rewriting the client integration.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;We use Vim with &lt;code&gt;vim-lsp&lt;/code&gt;&lt;sup&gt;&lt;a href=&quot;#fn2&quot;&gt;[2]&lt;/a&gt;&lt;/sup&gt; as our reference client, but the server does not know that. It speaks a standard protocol, which means the next editor is a configuration problem rather than a rewrite.&lt;/p&gt;
&lt;h2&gt;LSP in sixty seconds&lt;/h2&gt;
&lt;p&gt;An LSP server is a process that talks JSON-RPC 2.0 to an editor client. In our case the transport is standard input and standard output.&lt;/p&gt;
&lt;p&gt;The client (the editor) sends two kinds of messages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;requests&lt;/strong&gt;, which have an &lt;code&gt;id&lt;/code&gt; and expect a response;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;notifications&lt;/strong&gt;, which have no &lt;code&gt;id&lt;/code&gt; and expect no response.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The server can also send notifications. Diagnostics are the important example. The client does not wait for them; the server pushes &lt;code&gt;textDocument/publishDiagnostics&lt;/code&gt; whenever it has a fresh result.&lt;/p&gt;
&lt;p&gt;A session begins with &lt;code&gt;initialize&lt;/code&gt;. The response is a contract: it tells the client which features the server supports. If we advertise hover, the client sends hover requests. If we advertise completion, it asks for completions. If we advertise formatting and never implement it, the editor exposes a command that does nothing.&lt;/p&gt;
&lt;p&gt;Our capabilities are deliberately narrow:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{
  &quot;capabilities&quot;: {
    &quot;textDocumentSync&quot;: {
      &quot;openClose&quot;: true,
      &quot;change&quot;: 1
    },
    &quot;hoverProvider&quot;: true,
    &quot;completionProvider&quot;: {
      &quot;resolveProvider&quot;: false,
      &quot;triggerCharacters&quot;: [&quot;_&quot;, &quot;.&quot;]
    }
  },
  &quot;serverInfo&quot;: {
    &quot;name&quot;: &quot;finlang&quot;,
    &quot;version&quot;: &quot;1.4.0&quot;
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;change: 1&lt;/code&gt; means full document sync. Every change notification contains the entire buffer. That is unfashionable, but Finacle scripts are small enough that sending the whole document is cheap, and full sync removes a class of incremental-edit bugs we did not want to own.&lt;/p&gt;
&lt;p&gt;The server supports &lt;code&gt;initialize&lt;/code&gt;, &lt;code&gt;textDocument/didOpen&lt;/code&gt;, &lt;code&gt;textDocument/didChange&lt;/code&gt;, &lt;code&gt;textDocument/didClose&lt;/code&gt;, &lt;code&gt;textDocument/hover&lt;/code&gt;, &lt;code&gt;textDocument/completion&lt;/code&gt;, &lt;code&gt;shutdown&lt;/code&gt;, and &lt;code&gt;exit&lt;/code&gt;. Unknown requests get a standard &lt;code&gt;-32601&lt;/code&gt; &quot;Method not found&quot; response. Unknown notifications are ignored.&lt;/p&gt;
&lt;h2&gt;The language we are serving&lt;/h2&gt;
&lt;p&gt;Finacle scripts are not a general-purpose programming language. They are a domain-specific runtime language for banking customization. They were not designed around a grammar we can hand to a parser generator, and most of its behavior is resolved at runtime.&lt;/p&gt;
&lt;p&gt;A small example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;--START

IF (FIELDEXISTS(CUST.DTLS.custPAN) == 1) THEN
#{
    CUST.DTLS.userId = BANCS.STDIN.userId
    sv_a = urhk_SetOrbWarning(&quot;Customer PAN is mandatory&quot;)
#}
ENDIF

END--&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A few things matter for tooling:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;IF&lt;/code&gt;/&lt;code&gt;ENDIF&lt;/code&gt; and &lt;code&gt;WHILE&lt;/code&gt;/&lt;code&gt;DO&lt;/code&gt; have their own pairing rules.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;--START&lt;/code&gt; and &lt;code&gt;END--&amp;gt;&lt;/code&gt; are mandatory envelope tags.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sv_*&lt;/code&gt; variables are scratchpad variables; &lt;code&gt;lv_*&lt;/code&gt; variables are local to a script.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;CUST.DTLS.custPAN&lt;/code&gt; is a repository variable. Repositories and classes are created and deleted at runtime with &lt;code&gt;CREATEREP&lt;/code&gt;, &lt;code&gt;CREATECLASS&lt;/code&gt;, &lt;code&gt;DELETEREP&lt;/code&gt;, and &lt;code&gt;DELETECLASS&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;CALL(&quot;setup&quot;)&lt;/code&gt; and &lt;code&gt;CALLSCRIPTIFEXIST(&quot;setup&quot;)&lt;/code&gt; invoke other &lt;code&gt;scr&lt;/code&gt; files.&lt;/li&gt;
&lt;li&gt;Double-quoted strings do not treat a backslash as an escape character. In &lt;code&gt;sv_a = &quot;\&quot;&lt;/code&gt;, the final quote closes the string.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;urhk_*&lt;/code&gt; functions are runtime helpers documented outside the language itself.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There is no formal grammar we can feed into a parser generator, and with so much behavior determined at runtime, we chose to build a tolerant analyzer rather than a strict parser.&lt;/p&gt;
&lt;h2&gt;Architecture&lt;/h2&gt;
&lt;p&gt;The architecture is compact enough to explain in a few lines:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Vim + vim-lsp (or another client)
        │  JSON-RPC 2.0 over stdio
        ▼
      main.py         logging, stdin reader thread, event loop, lifecycle
        ▼
      server.py       documents, routing, diagnostics scheduling, hover, completion
        ▼
      linter/         shared lexer, rules, type checker, cross-file scan
        ▼
  workspace files     CALL(...) scripts, finacle_docs.json
&lt;/code&gt;&lt;/pre&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Path&lt;/th&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;main.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Process startup, logging, stdin reader thread, event loop, lifecycle&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;server.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;JSON-RPC framing, document state, routing, debounce, hover, completion&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;linter/__init__.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Rule registry and diagnostics engine&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;linter/text.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shared lexer producing raw, code, and masked views&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;linter/finacle.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shared patterns for calls, repositories, classes, assignments&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;linter/typecheck.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Tokenizer, expression parser, type state&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;linter/rules/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;One module per diagnostic rule&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;finacle_docs.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Hover and completion documentation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;vimrc&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reference vim-lsp configuration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;test_*.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Unit and regression tests&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Separating process management into main.py and protocol logic into server.py keeps both easier to test. The server module does not start threads or configure logging. The entry point does not know how a hover request is answered.&lt;/p&gt;
&lt;h2&gt;The wire: JSON-RPC framing&lt;/h2&gt;
&lt;p&gt;LSP over stdio is framed with a &lt;code&gt;Content-Length&lt;/code&gt; header:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Content-Length: 123\r\n
\r\n
{&quot;jsonrpc&quot;:&quot;2.0&quot;,&quot;id&quot;:1,&quot;method&quot;:&quot;initialize&quot;,&quot;params&quot;:{...}}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The length is in &lt;strong&gt;bytes&lt;/strong&gt;, not characters. Getting that wrong is a classic way to produce a server that works until someone types a non-ASCII character.&lt;/p&gt;
&lt;p&gt;The reader consumes header lines until a blank line, parses &lt;code&gt;Content-Length&lt;/code&gt;, and reads exactly that many bytes. We cap the body at 64 MiB. A malformed or hostile length should not make the server allocate an unbounded buffer. Truncated bodies are rejected rather than parsed.&lt;/p&gt;
&lt;p&gt;On the way out we use compact JSON and serialize writes with an &lt;code&gt;asyncio.Lock&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;body = json.dumps(payload, separators=(&quot;,&quot;, &quot;:&quot;)).encode(&quot;utf-8&quot;)
header = f&quot;Content-Length: {len(body)}\r\n\r\n&quot;.encode(&quot;latin1&quot;)

async with _get_write_lock():
    sys.stdout.buffer.write(header)
    sys.stdout.buffer.write(body)
    sys.stdout.buffer.flush()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The lock is not optional. Several request handlers can finish at once, and interleaving two JSON bodies on stdout corrupts the stream in a way that is painful to diagnose.&lt;/p&gt;
&lt;p&gt;The other rule is simple: &lt;strong&gt;nothing else writes to stdout&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;Reading stdin without stalling the server&lt;/h2&gt;
&lt;p&gt;A language server must keep reading messages while it processes requests. If we block the event loop in &lt;code&gt;sys.stdin.readline()&lt;/code&gt;, diagnostics and hover requests stop until the next message arrives.&lt;/p&gt;
&lt;p&gt;Running that read in the default thread pool is also a bad fit: it occupies a worker forever. Instead, &lt;code&gt;main.py&lt;/code&gt; starts a dedicated daemon thread whose only job is to read one framed message and hand it to an &lt;code&gt;asyncio.Queue&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;reader = threading.Thread(
    target=_reader_thread,
    args=(loop, queue),
    name=&quot;finlang-stdin&quot;,
    daemon=True,
)
reader.start()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The event loop then creates one task per message. Messages are read in order, but handlers can overlap. A slow lint does not prevent a hover from being answered, and the write lock keeps the wire well-formed.&lt;/p&gt;
&lt;p&gt;Diagnostics run in a single-worker &lt;code&gt;ThreadPoolExecutor&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;LINT_POOL = ThreadPoolExecutor(
    max_workers=1,
    thread_name_prefix=&quot;finlang-lint&quot;,
)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That is deliberate. The work is CPU-bound Python. More workers would mostly compete for the GIL, increase memory pressure, and make &quot;latest edit wins&quot; harder to reason about. One worker keeps the policy simple.&lt;/p&gt;
&lt;p&gt;The exit path is deliberately blunt. When the client sends &lt;code&gt;exit&lt;/code&gt;, we flush the streams and call &lt;code&gt;os._exit(0)&lt;/code&gt;. The stdin reader is a daemon thread blocked in a buffered read, and a normal interpreter shutdown can abort with a fatal &quot;buffered busy&quot; error when a daemon thread is still inside a buffered I/O call. &lt;code&gt;exit&lt;/code&gt; is an instruction to terminate now, so we flush and leave. The normal EOF path is graceful: pending tasks are cancelled, the executor is shut down, and the server logs that it stopped.&lt;/p&gt;
&lt;h2&gt;Diagnostics: latest edit wins&lt;/h2&gt;
&lt;p&gt;Diagnostics are the center of the server. Document state is intentionally smoll:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;@dataclass
class Document:
    text: str
    version: int = 0
    revision: int = 0
    lint_task: Optional[asyncio.Task] = None
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;version&lt;/code&gt; is the client&apos;s document version. &lt;code&gt;revision&lt;/code&gt; is our own monotonic counter, shared across open and close cycles. The distinction matters because a document can be closed and reopened, so the client&apos;s version is not enough to decide whether a lint result is still current.&lt;/p&gt;
&lt;p&gt;The pipeline is:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Store the latest text and version.&lt;/li&gt;
&lt;li&gt;Increment the revision.&lt;/li&gt;
&lt;li&gt;Cancel the previous lint task if it is still running.&lt;/li&gt;
&lt;li&gt;Start a new debounce task.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The debounce task waits, runs the linter in the worker pool, and publishes diagnostics:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;await asyncio.sleep(DEBOUNCE_SECONDS)

document = DOCUMENTS.get(uri)
if document is None or document.revision != revision:
    return

diagnostics = await loop.run_in_executor(
    LINT_POOL, run_diagnostics, uri, document.text
)

document = DOCUMENTS.get(uri)
if document is None or document.revision != revision:
    return

await send_message({
    &quot;jsonrpc&quot;: &quot;2.0&quot;,
    &quot;method&quot;: &quot;textDocument/publishDiagnostics&quot;,
    &quot;params&quot;: {
        &quot;uri&quot;: uri,
        &quot;version&quot;: document.version,
        &quot;diagnostics&quot;: diagnostics,
    },
})
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The default debounce is 150 ms, configurable with &lt;code&gt;FINLANG_DEBOUNCE&lt;/code&gt;. The reference Vim configuration lowers it to 50 ms because the server is already coalescing edits, and vim-lsp&apos;s own event queue would otherwise add another second of latency.&lt;/p&gt;
&lt;p&gt;The two revision checks are not redundant. The first catches a change that arrived during the debounce sleep. The second catches a change that arrived &lt;strong&gt;while the linter was running&lt;/strong&gt;. Without it, this sequence breaks:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The user types, starting a lint of revision 10.&lt;/li&gt;
&lt;li&gt;The linter takes 80 ms.&lt;/li&gt;
&lt;li&gt;The user types again, creating revision 11.&lt;/li&gt;
&lt;li&gt;The revision 10 lint finishes and publishes stale diagnostics.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The result is a squiggle on code the user already fixed, or a diagnostic that disappeares because an older result arrived last.&lt;/p&gt;
&lt;p&gt;On &lt;code&gt;textDocument/didClose&lt;/code&gt;, we remove the document, cancel its pending lint, and publish an empty diagnostics list so the client clears anything left behind.&lt;/p&gt;
&lt;p&gt;Full sync keeps the change handler small. The last entry in &lt;code&gt;contentChanges&lt;/code&gt; carries the complete document, so we assign it rather than applying ranges:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;changes = params.get(&quot;contentChanges&quot;) or []
if changes:
    last_change = changes[-1]
    if &quot;text&quot; in last_change:
        document.text = last_change[&quot;text&quot;]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;More bytes on the wire, fewer edit-reconciliation bugs on our side. For the size of a typical Finacle script, that is the right trade.&lt;/p&gt;
&lt;h2&gt;The linter: a set of small opinions&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;linter/__init__.py&lt;/code&gt; owns the rule registry:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ACTIVE_RULES = (
    UnclosedQuotesRule,
    BlockMatchingRule,
    EnvelopeTagsRule,
    IfSyntaxRule,
    UninitializedVariableRule,
    VariableTypeRule,
)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Every rule has the same interface:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;@classmethod
def analyze(cls, uri, text, lines, views=None) -&amp;gt; list[dict]:
    ...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The engine builds shared views once and passes them to every rule. If a rule raises, we log it and keep going. One broken rule should not blank diagnostics for the whole file.&lt;/p&gt;
&lt;h3&gt;One lexer, three views&lt;/h3&gt;
&lt;p&gt;Finacle&apos;s comment and string rules are subtle enough that we did not want each rule to implement its own scanner. &lt;code&gt;linter/text.py&lt;/code&gt; computes three views per line in one pass:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;View&lt;/th&gt;
&lt;th&gt;Contents&lt;/th&gt;
&lt;th&gt;Used for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;raw&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The original line, including comments and strings&lt;/td&gt;
&lt;td&gt;Reporting full-line ranges&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;code&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The line with &lt;code&gt;#&lt;/code&gt; comments removed, but &lt;code&gt;#{&lt;/code&gt; / &lt;code&gt;#}&lt;/code&gt; preserved&lt;/td&gt;
&lt;td&gt;Structural checks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;masked&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;code&lt;/code&gt; with string literals replaced by spaces&lt;/td&gt;
&lt;td&gt;Keyword and identifier scanning&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Strings are replaced with spaces rather than removed, so columns still line up with the original text. Comments are truncated, not rewritten, for the same reason.&lt;/p&gt;
&lt;p&gt;The lexer also records whether a quote was left open:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;@dataclass(frozen=True)
class LineView:
    raw: str
    code: str
    masked: str
    unclosed_quote: Optional[str] = None
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Some language-specific decisions live here:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;strings match before comments, so &lt;code&gt;#&lt;/code&gt; inside a string is not a comment;&lt;/li&gt;
&lt;li&gt;double-quoted strings end at the next double quote, because a backslash is an ordinary character;&lt;/li&gt;
&lt;li&gt;single-quoted strings do keep backslash handling;&lt;/li&gt;
&lt;li&gt;an unterminated literal is recorded, and the rest of the line is masked so one missing quote does not cascade into a second false string.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Sharing the lexer was one of the better decisions in the project. Before it, several rules had their own comment/string state machines and disagreed at the edges. Now they all see the same line.&lt;/p&gt;
&lt;h2&gt;Hover and completion&lt;/h2&gt;
&lt;p&gt;Hover is a small feature with a large onboarding payoff. Put the cursor on &lt;code&gt;urhk_dbSelectWithBind&lt;/code&gt;, press &lt;code&gt;K&lt;/code&gt;, and get the documentation without leaving Vim.&lt;/p&gt;
&lt;p&gt;The documentation lives in &lt;code&gt;finacle_docs.json&lt;/code&gt;. At startup we load it into a case-insensitive lookup table.&lt;/p&gt;
&lt;p&gt;The response is markdown:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;### Finacle Reference

`urhk_dbSelectWithBind`

**urhk_dbSelectWithBind(query)**: Selects data from the database using bind variables.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If no documentation exists, the server still returns the symbol name in a generic hover. Less useful, but better than an empty popup.&lt;/p&gt;
&lt;p&gt;Completion is precomputed at startup from the same documentation file. Each item has a label, a &lt;code&gt;filterText&lt;/code&gt; with the original spelling, an LSP kind, a detail string, and markdown documentation.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;resolveProvider&lt;/code&gt; is &lt;code&gt;false&lt;/code&gt; because every item already includes its documentation. Completion currently returns the full list and lets the client filter it. That is fine for a few dozen items. If the documentation grows into the thousands, we will need server-side filtering and ranking.&lt;/p&gt;
&lt;h2&gt;The Vim side&lt;/h2&gt;
&lt;p&gt;The server is editor-agnostic. Our reference client is Vim with &lt;code&gt;vim-lsp&lt;/code&gt;, and the repository includes a &lt;code&gt;vimrc&lt;/code&gt; that can be sourced from an existing config or used standalone.&lt;/p&gt;
&lt;p&gt;It does three things:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Registers the server for the &lt;code&gt;finacle&lt;/code&gt; filetype.&lt;/li&gt;
&lt;li&gt;Turns on the diagnostics UI we want: virtual text below the line, signs, and highlights, including in insert mode.&lt;/li&gt;
&lt;li&gt;Disables features the server does not implement, so the editor does not generate unsupported requests.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The registration is small:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;call lsp#register_server({
      \ &apos;name&apos;: &apos;finlang&apos;,
      \ &apos;cmd&apos;: {server_info -&amp;gt; [g:finlang_python, g:finlang_server]},
      \ &apos;allowlist&apos;: [&apos;finacle&apos;],
      \ &apos;root_uri&apos;: function(&apos;s:finlang_root_uri&apos;),
      \ })
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Two settings are worth calling out:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;let g:lsp_use_event_queue = 0
let $FINLANG_DEBOUNCE = &apos;0.05&apos;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;vim-lsp normally waits before forwarding changes. Since the server already debounces and supersedes stale work, we disable that queue and let the server own the timing. The 50 ms debounce keeps typing responsive without linting every intermediate keystroke.&lt;/p&gt;
&lt;p&gt;Buffer-local mappings make the features discoverable: &lt;code&gt;&amp;lt;C-Space&amp;gt;&lt;/code&gt; opens completion, &lt;code&gt;K&lt;/code&gt; shows hover, &lt;code&gt;[g&lt;/code&gt; and &lt;code&gt;]g&lt;/code&gt; move between diagnostics, &lt;code&gt;&amp;lt;leader&amp;gt;d&lt;/code&gt; opens the diagnostic list, and &lt;code&gt;&amp;lt;leader&amp;gt;ls&lt;/code&gt; shows server status.&lt;/p&gt;
&lt;p&gt;To try it from an existing Vim configuration:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;source ~/Developer/finlang/vimrc
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or start a clean Vim with only the Finlang configuration:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;vim -u ~/Developer/finlang/vimrc path/to/script.scr
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The server writes to a rotating log in the system temporary directory by default:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;tail -f &quot;${TMPDIR:-/tmp}/finlang_lsp.log&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Set &lt;code&gt;FINLANG_LOG_DIR&lt;/code&gt; before launching Vim if you want the log somewhere more permanent.&lt;/p&gt;
&lt;h2&gt;A few things we&apos;d do differently&lt;/h2&gt;
&lt;p&gt;Two of our early decisions still show up in the code comments.&lt;/p&gt;
&lt;p&gt;The first was letting each rule do its own comment and string scanning. It felt local and simple: a rule needed to know whether a &lt;code&gt;#&lt;/code&gt; was inside a string, so it handled that itself. The rules slowly drifted. A quote inside a comment was handled one way in one rule and another way somewhere else. We eventually pulled that into &lt;code&gt;linter/text.py&lt;/code&gt;, which now produces the raw, code, and masked views once. New rules got shorter, and the diagnostics stopped contradicting each other.&lt;/p&gt;
&lt;p&gt;The second was scanning block markers character by character inside &lt;code&gt;BlockMatchingRule&lt;/code&gt;. That worked, but it duplicated logic the lexer already had and made the rule harder to reason about. The current version walks the masked line with a regular expression and three stacks. It is not clever, but it is easier to test.&lt;/p&gt;
&lt;p&gt;The third is less concrete. We spent too long treating &quot;complete&quot; as the goal. A language server does not need to understand every Finacle construct to be useful; it needs to be right about the constructs it does understand. Most of the value came from a handful of checks that are boring, local and reliable.&lt;/p&gt;
&lt;p&gt;We still have to resist that instinct when adding a rule. The question is not &quot;can we detect this?&quot; It is &quot;will a developer thank us for this squiggle?&quot;&lt;/p&gt;
&lt;h2&gt;What is missing&lt;/h2&gt;
&lt;p&gt;Finlang is deliberately scoped. It does not support go-to-definition, find references, rename, formatting, code actions, signature help, or semantic tokens. It does not do incremental document sync. It does not maintain a full workspace index or recursively walk the call graph. It cannot resolve dynamically constructed script paths. It does not implement a complete Finacle grammar.&lt;/p&gt;
&lt;p&gt;The next steps are obvious enough: incremental sync for very large files, a workspace index for definitions and references, quick fixes for common diagnostics such as missing &lt;code&gt;#}&lt;/code&gt;, &lt;code&gt;ENDIF&lt;/code&gt;, or envelope tags, and signature help for the &lt;code&gt;urhk_*&lt;/code&gt; functions. None of those require rethinking the architecture. The editor integration stays stable while the language intelligence improves.&lt;/p&gt;
&lt;h2&gt;Where this leaves us&lt;/h2&gt;
&lt;p&gt;Finlang started as a linter and became a language server because the protocol gave us a clean boundary between what we know about Finacle and how the editor displays it.&lt;/p&gt;
&lt;p&gt;The implementation is small enough to hold in your head:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;main.py&lt;/code&gt; handles the process and the transport;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;server.py&lt;/code&gt; handles documents, routing, diagnostics, hover, and completion;&lt;/li&gt;
&lt;li&gt;a shared lexer gives every rule the same view of a line;&lt;/li&gt;
&lt;li&gt;a handful of focused rules encode what we know about the language;&lt;/li&gt;
&lt;li&gt;a conservative type checker avoids guessing;&lt;/li&gt;
&lt;li&gt;a one-hop cross-file scan follows &lt;code&gt;CALL(...)&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;and a Vim configuration turns it into a daily tool.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It is not a compiler, and it is not trying to be. It is a set of checks we trust enough to leave on, with documentation where the language is obscure and diagnostics where the runtime is unforgiving.&lt;/p&gt;
&lt;p&gt;The server is in day-to-day use. That is the only benchmark that matters to us.&lt;/p&gt;
&lt;hr /&gt;
&lt;section&gt;
&lt;ol&gt;
&lt;li&gt;&lt;p&gt;https://microsoft.github.io/language-server-protocol/ &lt;a href=&quot;#fnref1&quot;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;https://github.com/prabirshrestha/vim-lsp &lt;a href=&quot;#fnref2&quot;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/section&gt;
</content:encoded></item><item><title>Everything is Math</title><link>https://www.atharqadri.com/posts/math-behind-ai/</link><guid isPermaLink="true">https://www.atharqadri.com/posts/math-behind-ai/</guid><description>Everyone&apos;s talking about the latest AI breakthroughs, but few are talking about the math quietly making them possible. This post digs into the simple ideas that power today&apos;s LLMs</description><pubDate>Sat, 01 Aug 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;It&apos;s strange how little attention (pun intended) gets paid to the
math that is actually powering the rise of LLMs. To give you an idea, the advent of LLMs
was around 2017 when researchers at Google published a ground-breaking paper&lt;sup&gt;&lt;a href=&quot;#fn1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;,
but the one algorithm (out of many)
that made it possible had already been lying there for around 170 years.&lt;sup&gt;&lt;a href=&quot;#fn2&quot;&gt;[2]&lt;/a&gt;&lt;/sup&gt; While everyone&apos;s
chasing the latest AI breakthrough, I dug into the math that actually
powers LLMs, and it&apos;s amazing how simple a function such as ReLU
can help power a system that mimics a human brain and does it pretty well.&lt;/p&gt;
&lt;p&gt;This write-up is an appreciation to all the mathematicians that have made it possible.&lt;/p&gt;
&lt;h2&gt;ReLU (Rectified Linear Unit)&lt;/h2&gt;
&lt;p&gt;In an LLM, this tiny rule is applied to activate a neuron through a simple rule:
&apos;If the number is negative, make it zero. If it&apos;s positive, do nothing.&apos;&lt;/p&gt;
&lt;p&gt;Without something like ReLU (or its cousins), the entire LLM would collapse into
one big linear equation and couldn’t learn complex language patterns.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/relu.png&quot; alt=&quot;ReLU activation function: flat at zero for negative inputs, rising linearly for positive inputs&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;Euler&apos;s Constant (&lt;em&gt;e&lt;/em&gt;)&lt;/h2&gt;
&lt;section&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;2.7182817...
2.7182817...
&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;2.7182817...&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/section&gt;&lt;p&gt;The constant itself had already been there for decades but it was Leonhard Euler
who gave it a name. In 1727, when he was just 21 years old, Euler used the letter
&lt;em&gt;e&lt;/em&gt; for it in a paper recording his own experiments on the firing of a cannon.&lt;sup&gt;&lt;a href=&quot;#fn3&quot;&gt;[3]&lt;/a&gt;&lt;/sup&gt;
The paper wasn&apos;t published until 1862, nearly 80 years after his death.&lt;/p&gt;
&lt;p&gt;From being used in financial calculations to radioactive decay, it has found
its way into the world of AI and machine learning and that brings us to Sigmoid Functions.&lt;/p&gt;
&lt;h2&gt;Sigmoid Function&lt;/h2&gt;
&lt;p&gt;The first sigmoid function was introduced by Pierre François Verhulst, a Belgian mathematician,
in year 1838 in his paper &lt;sup&gt;&lt;a href=&quot;#fn4&quot;&gt;[4]&lt;/a&gt;&lt;/sup&gt; on population growth. LLMs use the standard logistic function, a type of sigmoid function, that maps any real input onto a value between zero and one:&lt;/p&gt;
&lt;section&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;σ(x)=11+e−x
\sigma(x) = \frac{1}{1 + e^{-x}}
&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;σ&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;x&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;+&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;e&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;−&lt;/span&gt;&lt;span&gt;x&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/section&gt;&lt;p&gt;Where ReLU is sharp and one-sided, sigmoid is smooth and symmetric.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/sigmoid.png&quot; alt=&quot;Sigmoid function: S-shaped curve&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Because its output is always bounded in &lt;span&gt;&lt;span&gt;(0,1)(0, 1)&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;, sigmoid is useful when you
need a probability: the neuron&apos;s decision making ability that a token belongs
to a given class, for example.&lt;/p&gt;
&lt;h2&gt;Softmax&lt;/h2&gt;
&lt;section&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;softmax(zi)=ezi∑j=1nezj
\text{softmax}(z_i) = \frac{e^{z_i}}{\sum_{j=1}^{n} e^{z_j}}
&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;softmax&lt;/span&gt;&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&lt;span&gt;z&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;i&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;∑&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;j&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;n&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;e&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;z&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;j&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;e&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;z&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;i&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/section&gt;&lt;p&gt;Sigmoid handles a single binary decision: it gives you one probability of how likely
the answer is between two options. For an LLM to choose its next token
from its vocabulary, it needs to give it a probability distribution.
That&apos;s what softmax is for: it takes a whole list of raw scores
(called logits) and turns them into a proper probability distribution, where every
value sits between 0 and 1 and the whole set adds up to 1.&lt;/p&gt;
&lt;p&gt;Let&apos;s say the model is finishing the sentence
&quot;The cat sat on the ___.&quot; Before softmax, each word just has a raw score.
After softmax, those scores become a probability distribution the model can actually sample from:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Token&lt;/th&gt;
&lt;th&gt;Logit (before softmax)&lt;/th&gt;
&lt;th&gt;Probability (after softmax)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;mat&lt;/td&gt;
&lt;td&gt;2.5&lt;/td&gt;
&lt;td&gt;0.710&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;floor&lt;/td&gt;
&lt;td&gt;1.0&lt;/td&gt;
&lt;td&gt;0.158&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;chair&lt;/td&gt;
&lt;td&gt;0.5&lt;/td&gt;
&lt;td&gt;0.096&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;roof&lt;/td&gt;
&lt;td&gt;-0.5&lt;/td&gt;
&lt;td&gt;0.035&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The term &quot;softmax&quot; wasn&apos;t coined until 1989, by researcher John S. Bridle, who
described it as a smooth, differentiable stand-in for simply picking the largest
value.&lt;sup&gt;&lt;a href=&quot;#fn5&quot;&gt;[5]&lt;/a&gt;&lt;/sup&gt; But the shape of the function is much older and the physicists were already
using in the 1860s to describe how particles spread across energy states.&lt;/p&gt;
&lt;p&gt;To be continued...&lt;/p&gt;
&lt;hr /&gt;
&lt;section&gt;
&lt;ol&gt;
&lt;li&gt;&lt;p&gt;https://arxiv.org/abs/1706.03762 &lt;a href=&quot;#fnref1&quot;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;http://sites.mathdoc.fr/cgi-bin/oeitem?id=OE_CAUCHY_1_10_399_1 &lt;a href=&quot;#fnref2&quot;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;https://scholarlycommons.pacific.edu/euler-works/853/ &lt;a href=&quot;#fnref3&quot;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;https://www.researchgate.net/publication/5086329_Pierre-Francois_Verhulst_et_la_loi_logistique_de_la_population &lt;a href=&quot;#fnref4&quot;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;https://arxiv.org/pdf/1704.00805 &lt;a href=&quot;#fnref5&quot;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/section&gt;
</content:encoded></item></channel></rss>