[HN Gopher] Show HN: GlyphLang - An AI-first programming language
___________________________________________________________________
Show HN: GlyphLang - An AI-first programming language
While working on a proof of concept project, I kept hitting
Claude's token limit 30-60 minutes into their 5-hour sessions. The
accumulating context from the codebase was eating through tokens
fast. So I built a language designed to be generated by AI rather
than written by humans. GlyphLang GlyphLang replaces verbose
keywords with symbols that tokenize more efficiently:
# Python @app.route('/users/<id>') def get_user(id):
user = db.query("SELECT * FROM users WHERE id = ?", id)
return jsonify(user) # GlyphLang @ GET /users/:id
{ $ user = db.query("SELECT * FROM users WHERE id = ?", id)
> user } @ = route, $ = variable, > = return.
Initial benchmarks show ~45% fewer tokens than Python, ~63% fewer
than Java. In practice, that means more logic fits in
context, and sessions stretch longer before hitting limits. The AI
maintains a broader view of your codebase throughout. Before
anyone asks: no, this isn't APL with extra steps. APL, Perl, and
Forth are symbol-heavy but optimized for mathematical notation,
human terseness, or machine efficiency. GlyphLang is specifically
optimized for how modern LLMs tokenize. It's designed to be
generated by AI and reviewed by humans, not the other way around.
That said, it's still readable enough to be written or tweaked if
the occasion requires. It's still a work in progress, but it's a
usable language with a bytecode compiler, JIT, LSP, VS Code
extension, PostgreSQL, WebSockets, async/await, generics. Docs:
https://glyphlang.dev/docs GitHub:
https://github.com/GlyphLang/GlyphLang
Author : goose0004
Score : 34 points
Date : 2026-01-10 23:46 UTC (23 hours ago)
| everlier wrote:
| Arguably, math notation and set theory already has everything
| that we need.
|
| For example see this prompt describing an app:
| https://textclip.sh/?ask=chatgpt#c=XZTNbts4EMfvfYqpc0kQWpsEc...
| goose0004 wrote:
| That's an awesome tool! I think textclip.sh solves a different
| problem though (correct me if I'm wrong - this is the first
| I've been exposed to it). Compression at the URL/transport
| layer helps with sharing prompts, but the token count still
| hits you once the text is decompressed and fed into the model.
| The LLM sees the full uncompressed text.
|
| The approach with GlyphLang is to make the source code itself
| token-efficient. When an LLM reads something like `@ GET
| /users/:id { $ user = query(...) > user }`, that's what gets
| tokenized (not a decompressed version). The reduced
| tokenization persists throughout the context window for the
| entire session.
|
| That said, I don't think they're mutually exclusive. You could
| use textclip.sh to share GlyphLang snippets and get both
| benefits.
| everlier wrote:
| Yes, the tool here is just to share the prompt, sorry the
| first one I had handy is the one describing the service
| itself.
|
| Here's it in plain text to be more visible:
|
| ``` textclip.sh-URL gen: #t=<txt>-copy page |
| ?ask=<preset>#t=-svc redirect | ?redirect=<url>#t=-custom(use
| __TEXT__ placeholder). presets[?]{claude,chatgpt,perplexity,g
| emini,google,bing,kagi,duckduckgo,brave,ecosia,wolfram}.
| len>500-auto deflate-raw #c= base64url encoded,
| efficient<=16k tokens. custom redirect-local LLM|any ?param
| svc. view mode: txt display+copy btn+new clip btn; copy-
| clipboard API-"Copied!" feedback 2s. create mode:
| textarea+live counters{chars,~tokens(len/4),url len}; color
| warn: tokens>=8k-yellow,>=16k-red; url>=7k-yellow,>=10k-red.
| badge gen: shields.io md [!alt](target_url); ```
|
| It uses math notation to heavily compress the representation
| while keeping information content relatively preserved
| (similarly to GlyphLang. Later, LLM can comfortably use it to
| describe service in detail and answer user's questions about
| it. Same is applicable to arbitrary information, including
| source code/logic.
| noosphr wrote:
| I've found that short symbols cause collisions with other tokens
| in the llms vocabulary. It is generally much better to have long
| descriptive names for everything in a language than short ones.
|
| An example that shocked me was using an xml translation of C for
| better vector search. The lack of curly braces made the model
| return much more relavent code than using anything else,
| including enriching the database with ctags.
|
| >GlyphLang is specifically optimized for how modern LLMs
| tokenize.
|
| This is extremely dubious. The vocabulary of tokens isn't
| conserved inside model families, let alone entirely different
| types of models. The only thing they are all good at is
| tokenizing English.
| goose0004 wrote:
| The collision point is interesting, but I'd argue context
| disambiguates. If I'm understanding you correctly, I don't
| think the models are confused about whether or not it's looking
| at an email when `@` appears before a route pattern. These
| symbols are heavily represented in programming contexts (e.g.
| Python decorators, shell scripts, etc.), so LLMs have seen them
| plenty of times in code. I'd be interested if you shared your
| findings though! Definitely an issue I would like to see if I
| could avoid or at least mitigate somewhat.
|
| That's an absolutely fair point that vocabularies differ
| regarding the tokenizer variance, but the symbols GlyphLang
| uses are ASCII characters that tokenize as single tokens across
| GPT4, Claude, and Gemini tokenizers. THe optimization isn't
| model-specific, but rather it's targeting the common case of
| "ASCII char = 1 token". I could definitely reword my post
| though - looking at it more closely, it does read more as "fix-
| all" rather than "fix-most".
|
| Regardless, I'd genuinely be interested in seeing failure
| cases. It would be incredibly useful data to see if there are
| specific patterns where symbol density hurts comprehension.
| rubyn00bie wrote:
| I think there's a certain amount of novelty to this, and the
| aesthetic of the language I find pleasing, but I'm a little
| confused... Admittedly, I didn't read the entire doc and only
| quickly glanced at the source... But is it just transpiling
| Golang code to and from this syntax, or is it intended to be a
| whole language eventually? Can folks able to just import golang
| packages or do they have to only use what packages are currently
| supported?
|
| Additionally I have two thoughts about it:
|
| 1. I think this might be more practical as a transparent layer so
| users can write and get Golang (or whatever) the original
| language was back. Essentially making it something only the model
| reads/outputs.
|
| 2.) Longer term it seems like both NVidia and AMD along with the
| companies training/running the models are focused on driving down
| cost per token because it's just too damn high. And I personally
| don't see a world where AI becomes pervasive without a huge drop
| in cost token-- it's not sustainable for companies running the
| models and end users really can't afford the real costs as they
| are today. My point being, will this even be necessary in a 12-18
| months?
|
| I could totally be missing things or lacking the vision of where
| this could go but I personally would worry that anything written
| with this has a very short shelf life.
|
| That's not to say it's not useful in the meantime, or not a cool
| project, more so if there is a longer term vision for it, I think
| it would be worth calling out.
| jbritton wrote:
| I had a conversation with Claude about what language to work in.
| It was a web app and it led me to Typescript mainly because of
| the training data for the model, plus typing and being able to
| write pure functions. Haskell might have been preferred except
| for the lower amounts of training data.
| jy14898 wrote:
| I feel like any deviation from the syntax LLMs are trained on is
| not productive.
|
| Sure you can represent the same code in fewer tokens but I doubt
| it'll get those tokens correct as often.
| rubyn00bie wrote:
| Yeah, big plus one from me. I recently tried to investigate
| some sort of alternative encoding to/from "the prompt," and was
| swiftly told that was both not possible and would work against
| me. As you pointed out, the LLMs are trained on language and
| language itself is often not terse. Trying to skirt that will
| cause the LLM to calculate the vectors poorly because the
| relation between the input tokens and its training data doesn't
| really exist.
| jaggederest wrote:
| Funny, I've been noodling on something that goes the other
| direction - avoiding symbols as much as possible and trying to
| use full english words.
|
| Very underbaked but https://github.com/jaggederest/locque
| omneity wrote:
| Do you have any evals on how good LLMs are at generating
| Glyphlang?
|
| I'm curious if you optimized for the ability to generate
| functioning code or just tokenization compression rate, which
| LLMs you tokenized for, and what was your optimization process
| like.
| 29athrowaway wrote:
| This could be an IR rather than a high level language.
| DonHopkins wrote:
| What about the cost of the millions of tokens you have to spend
| to prompt the LLM to understand your bespoke language with
| manuals and tutorials and examples and stack overflow discussions
| and the source code to the compiler, added to every single
| prompt, that it totally forgets after each iteration?
|
| It already knows python and javascript and markdown and yaml
| extremely well, so it requires zero tokens to teach it those
| languages, and doesn't need to be completely taught a new
| language it's never seen before from the ground up each prompt.
|
| You are treating token count as the only bottleneck, rather than
| comprehension fidelity.
|
| Context window management is a real problem, and designing for
| generation is a good instinct, but you need to design for what
| LLMs are already good at, not design a new syntax they have to
| learn.
|
| jaggederest's opposite approach (full English words, locque) is
| actually more aligned with how LLMs work -- they're trained on
| English and understand English-like constructs deeply.
|
| noosphr's comment is devastating: "Short symbols cause collisions
| with other tokens in the LLMs vocabulary." The @ in @ GET
| /users/:id activates Python decorator associations, shell
| patterns, email patterns, and more. The semantic noise may
| outweigh the token savings.
|
| Perl's obsessive fetish for compact syntax, sigils, punctuation,
| performative TMTOWTDI one-liners, to the point of looking like
| line noise, is why it's so terribly designed and no longer
| relevant or interesting for LLM comprehension and generation.
|
| I think the ideal syntax for LLM language understanding and
| generation are markdown and yaml, with some python, javascript,
| and preferably typescript thrown in.
|
| As much as I have always preferred json to yaml, it is inarguably
| better for LLMs. It beats json for llms because it avoids entropy
| collapse, has less syntax, leaves more tokens and energy for
| solving problems instead of parsing and generating syntax! Plus,
| it has comments, which are a game changer for comprehension, in
| both directions.
|
| https://x.com/__sunil_kumar_/status/1916926342882594948
|
| >sunil kumar: Changing my model's tool calling interface from
| JSON to YAML had surprising side effects.
|
| >Entropy collapse is one of the biggest issues with GRPO. I've
| learned that small changes to one's environment can have massive
| impacts on performance. Surprisingly, changing from JSON to YAML
| massively improved generation entropy stability, yielding much
| stronger performance.
|
| >Forcing a small model to generate properly structured JSON
| massively constrains the model's ability to search and reason.
|
| YAML Jazz:
|
| https://github.com/SimHacker/moollm/blob/main/skills/yaml-ja...
|
| YAML Jazz: Why Comments Beat Compression
|
| The GlyphLang approach treats token count as THE bottleneck.
| Wrong. Comprehension fidelity is the bottleneck.
|
| The LLM already knows YAML from training. Zero tokens to teach
| it. Your novel syntax costs millions of tokens per context window
| in docs, examples, and corrections.
|
| Why YAML beats JSON for LLMs:
|
| Sunil Kumar (Groundlight AI) switched from JSON to YAML for tool
| calling and found it "massively improved generation entropy
| stability." "Forcing a small model to generate
| properly structured JSON massively constrains the model's
| ability to search and reason."
|
| JSON pain: Strict bracket matching {}[]
| Mandatory commas everywhere Quote escaping \" NO
| COMMENTS ALLOWED Rigid syntax = entropy collapse
|
| YAML wins: Indentation IS structure Minimal
| delimiters Comments preserved Flexible = entropy
| preserved
|
| The killer feature: comments are data. timeout:
| 30 # generous because API is flaky on Mondays retries: 3
| # based on observed failure patterns
|
| The LLM reads those comments. Acts on them. JSON strips this
| context entirely.
|
| On symbol collision: noosphr nails it. Short symbols like @
| activate Python decorators, shell patterns, email patterns
| simultaneously. The semantic noise may exceed the token savings.
|
| Perl's syntax fetish is why it's irrelevant for LLM generation.
| Dense punctuation is anti-optimized for how transformers tokenize
| and reason.
|
| The ideal LLM syntax: markdown, yaml, typescript. Languages it
| already knows cold.
| momojo wrote:
| Great work!
|
| > In practice, that means more logic fits in context, and
| sessions stretch longer before hitting limits. The AI maintains a
| broader view of your codebase throughout.
|
| This is one of those 'intuitions' that I've also had. However, I
| haven't found any convincing evidence for or against it so far.
|
| In a similar vein, this is why `reflex`[0] intrigues me. IMO
| their value prop is "LLM's love Python, so let's write entire
| apps in python". But again, I haven't seen any hard numbers.
|
| Anyone seen any hard numbers to back this?
|
| [0] https://github.com/reflex-dev/reflex
| DonHopkins wrote:
| Instead of making up new languages, just clean up code in old
| programming languages so it doesn't smell so bad! ;)
|
| Sniffable Python: useful for Anthropic skill sister scripts, and
| in general.
|
| https://github.com/SimHacker/moollm/tree/main/skills/sniffab...
| tricorn wrote:
| Don't optimize the language to fit the tokens, optimize the
| tokens to fit the language. Tokenization is just a means to
| compress the text, use a lot of code in target languages to
| determine the tokenizing, then do the training using those
| tokens. More important is to have a language where the model can
| make valid predictions of what effective code will be. Models are
| "good" at Python because they see so much of it. To determine
| what language might be most appropriate for an AI to work with,
| you'd need to train multiple models, each with a tokenizer
| optimized for a language and training specifically targeting that
| language. One language I've had good success with, despite having
| low levels of training in it, is Tcl/Tk. As the language is
| essentially a wordy version of Lisp (despite Stallman's disdain
| for it), it is extremely introspective with the ability to modify
| the language from within itself. It also has a very robust
| extensible sandbox, and is reasonably efficient for an
| interpreted language. I've written a scaffold that uses Tcl as
| the sole tool-calling mechanism, and despite a lot of training
| distracting the model towards Python and JSON, it does fairly
| well. Unfortunately I'm limited in the models I can use because I
| have an old 8GB GPU, but I was surprised at how well it manages
| to use the Tcl sandbox with just a relatively small system
| prompt. Tcl is a very regular language with a very predictive
| structure and seems ideal for an LLM to use for tool calling,
| note taking, context trimming, delegation, etc. I haven't been
| working on this long, but it is close to the point where the
| model will be able to start extending its own environment (with
| anything potentially dangerous needing human intervention).
| p0w3n3d wrote:
| I think the gain is very little. Almost every English word is on
| token, the same with programming language keywords. So you're
| just replacing one keyword with another. The only gain in the
| example given is > instead of jsonify() which would be ~4 tokens.
|
| Please check your idea agains tiktokenizer
| p0w3n3d wrote:
| I've checked and you get 36->30 tokens decreasal but no human
| readability. sounds like a poor trade
___________________________________________________________________
(page generated 2026-01-11 23:01 UTC)