Show HN: GlyphLang – 一种 AI 优先的编程语言

1作者: goose00046 个月前
在进行一个概念验证项目时,我一直遇到 Claude 的 token 限制,通常在 5 小时会话的 30-60 分钟内达到。来自代码库的累积上下文迅速消耗了 token。因此,我构建了一种语言,旨在由 AI 生成,而不是由人类编写。 GlyphLang GlyphLang 用符号替换冗长的关键字,从而更有效地进行 token 化: ``` # 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. 初始基准测试显示,与 Python 相比,token 减少了约 45%,与 Java 相比,token 减少了约 63%。 ``` 实际上,这意味着更多的逻辑可以融入上下文,并且会话在达到限制之前可以持续更长时间。AI 可以在整个过程中保持对代码库更广泛的了解。 在有人问之前:不,这并不是一个多此一举的 APL。APL、Perl 和 Forth 都是符号密集的语言,但它们针对数学符号、人类简洁性或机器效率进行了优化。GlyphLang 专门针对现代 LLM 的 token 化方式进行了优化。它旨在由 AI 生成并由人类审查,而不是相反。也就是说,如果需要,它仍然具有足够的可读性,可以编写或调整。 它仍在开发中,但它是一种可用的语言,具有字节码编译器、JIT、LSP、VS Code 扩展、PostgreSQL、WebSockets、async/await、泛型。 文档:[https://glyphlang.dev/docs](https://glyphlang.dev/docs) GitHub:[https://github.com/GlyphLang/GlyphLang](https://github.com/GlyphLang/GlyphLang)
查看原文
While working on a proof of concept project, I kept hitting Claude&#x27;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.<p>GlyphLang<p>GlyphLang replaces verbose keywords with symbols that tokenize more efficiently:<p><pre><code> # Python @app.route(&#x27;&#x2F;users&#x2F;&lt;id&gt;&#x27;) def get_user(id): user = db.query(&quot;SELECT * FROM users WHERE id = ?&quot;, id) return jsonify(user) # GlyphLang @ GET &#x2F;users&#x2F;:id { $ user = db.query(&quot;SELECT * FROM users WHERE id = ?&quot;, id) &gt; user } @ = route, $ = variable, &gt; = return. Initial benchmarks show ~45% fewer tokens than Python, ~63% fewer than Java. </code></pre> 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.<p>Before anyone asks: no, this isn&#x27;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&#x27;s designed to be generated by AI and reviewed by humans, not the other way around. That said, it&#x27;s still readable enough to be written or tweaked if the occasion requires.<p>It&#x27;s still a work in progress, but it&#x27;s a usable language with a bytecode compiler, JIT, LSP, VS Code extension, PostgreSQL, WebSockets, async&#x2F;await, generics.<p>Docs: <a href="https:&#x2F;&#x2F;glyphlang.dev&#x2F;docs" rel="nofollow">https:&#x2F;&#x2F;glyphlang.dev&#x2F;docs</a><p>GitHub: <a href="https:&#x2F;&#x2F;github.com&#x2F;GlyphLang&#x2F;GlyphLang" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;GlyphLang&#x2F;GlyphLang</a>