展示HN:我做了一个“编程语言”,寻求反馈。
Show HN: I made a "programming language" looking for feedback

原始链接: https://github.com/alonsovm44/glupe

## Glupe:面向代码未来的语义元编程 Glupe 是一种新颖的“元”编程语言,它操作于*意图*而非语法之上,将人类定义的逻辑翻译成 40 多种目标语言的代码。与传统的元编程不同,Glupe 旨在抽象掉特定于语言的细节,确保代码在不断发展的技术中保持可移植性——解决“在我机器上可以运行”的问题,但针对的是*时间*,而不仅仅是环境(就像 Docker 解决空间问题一样)。 用户使用纯文本和特殊块 (`$$...$$`) 定义程序,以指定用于 AI 驱动代码生成的部分。这允许开发者在利用 LLM 处理实现细节的同时,保持架构控制,并安全地隔离 AI 逻辑。Glupe 通过与 LLM 的反馈循环来协调代码生成、编译,甚至错误修正。 主要特性包括对本地和云端 LLM 的支持、自动构建检测(Makefile、CMake 等)以及用于修复代码、生成文档甚至基于终端的技术支持的实用命令。Glupe 本身不是编译器,而是一种连接意图和实现的工具,可以加速原型设计并降低软件工程的门槛。它在 [GitHub](https://github.com/alonsovm44/glupe-tutorial) 上可用,并提供适用于 Windows、Linux 和 macOS 的简单安装指南。

一位开发者在Hacker News分享了“glp”,一种新的“编程语言”,其理念是*预处理* LLM 生成的代码,而不是直接将其自动补全到代码库中。该项目在 GitHub 上可用,旨在允许对原始提示(.glp “蓝图”)和生成的源代码进行版本控制。 初步反馈不佳。一位评论者质疑该语言的目的,认为主要由 LLM 生成的 README 组织混乱,并对项目质量表示担忧。他们特别批评了关于使用 Docker 容器存储 LLM 提示的说法,认为不应将非运行时文件包含在容器中。 另一位评论者指出,塞尔维亚语中的“glup”意思是“愚蠢”,而第三位则提出了更广泛的担忧,即软件开发与像 LLM 这样快速发展的技术紧密结合,以及仅仅因为现在更容易做到而重写系统的趋势。
相关文章

原文

Demo de Glupe Clone this repo to begin: https://github.com/alonsovm44/glupe-tutorial

License: MIT GitHub Release C++17 Platforms AI-Powered

Glupe is a semantic metaprogramming language. Unlike traditional metaprogramming systems that operate within a single language (C++ templates, Lisp macros), Glupe operates at the level of human intent and can materialize that intent into any target programming language. This positions Glupe as a 'meta' language not just in the technical sense of generating code, but in the philosophical sense of being one level above all programming languages.

Example meta-program:

% this is a comment
$$ include {
    standard io library
    vector library

}$$
$$ABSTRACT rules{
    every printed message must end with "!"
}$$

$$ABSTRACT rules2{
    every printed message must begin with "?"
}$$

$$ main -> rules, rules2 {
 let v = vector[1,2,3]
 print v   
}$$

Result:

This code can be compiled into 40+ supported languages or native executables.

"Glupe isolates AI logic into semantic containers, so your manual code stays safe."

Think of Glupe as "Docker for Logic."

Just as Docker packages the Environment to make software independent of the machine, Glupe packages the Intent to make software independent of the language.

They both solve "It works on my machine," but at different layers:

  • Docker freezes the Operating System. It ensures your code runs the same on your laptop, the cloud, or a server in 2015.
  • Glupe freezes the Algorithm. It ensures your code can be compiled to C++ today, Rust in 2030, or whatever language exists in 2050. Docker solves Space. Glupe solves Time.

Best of all, they work together. You can store your .glp blueprints in a Docker container—creating software that is immortal in both environment and logic.

Quick Install (Recommended)

Windows Installation guide

  1. Press Win + R and type cmd or open cmd.exe
  2. Type Powershell
  3. Run this command:
 irm https://raw.githubusercontent.com/alonsovm44/glupe/master/install.ps1 | iex

If you install Ollama be sure to accept all pop up windows. The installer automatically installs the latest version of Glupe.

Linux/macOS: Installation in Linux/macOS

  1. Open bash terminal and run the following command:
curl -fsSL https://raw.githubusercontent.com/alonsovm44/glupe/master/install.sh | bash

Manual Build

g++ glupec.cpp -o glupe -std=c++17 -lstdc++fs
glupe --init
glupe hello.glp -o hello.exe -cpp -local
.\hello

The risk of AI generated code

Every developer knows the risk of asking AI to modify a file: it’s like giving a junior developer root access to your production server. It's all or nothing. They might fix the bug, but they might also refactor your working code or delete critical comments.

We built Glupe to solve this trust problem.

Instead of a Host System we have a Source Code File. The Containers are the $${ }$$ blocks, isolated zones where the AI is allowed to work. Instead of isolating runtimes, Glupe isolates code blocks. The A.I is aware of the context outside the blocks, it undestands the logic of the rest of your program, but is forbbiden to touch it; it can run wild inside the container, generating complex logic, but it won't touch the host. It is safely contained.

Glupe allows for incremental builds via container hashing, if a container hasn't changed, it uses a cached code snippet to bypass LLM calls.

This turns AI from a chaotic re-writer from scratch into a precision tool. You maintain architectural control, while the AI handles the implementation details you want to give to it.

Traditional compilers (GCC, Clang, rustc) translate code based on syntax and do not attempt to fix errors for you. When a build fails, you are left to interpret compiler messages, search documentation, and debug the issue manually.

Glupe is a command-line tool that sits between your intent (written in plain text or pseudo-code) and your existing build tools. It uses a configured language model (local or cloud) to generate source code, writes the output to disk, and optionally runs the compiler or build script.

If compilation fails, Glupe can attempt to fix the problem by re-running the model with the compiler error output, up to a configurable number of retries.

Glupe is not a deterministic compiler or a formal transpiler. It is an orchestrator that relies on external compilers and the quality of the configured language model, using LLMs to assist with code generation and build orchestration


AI-Powered Code Generation

Generate executable code from natural language, mixed languages, or existing files:

glupe utils.py myalgorithm.c -o myprogram.exe -cpp -cloud

Combine Python, C, and intent → get a native C++ binary

Multi-File Project Generation

Use EXPORT: blocks to define entire projects in a single .glp file:

EXPORT: "mylib.h"
$$ myfunc { define a function 'myfunction()' that returns square of a number }$$
EXPORT: END

EXPORT: "myprogram.cpp"
#include <iostream>
#include <vector>
#include "mylib.h"

int main(){
  int x = 3;
  $$ main { 
    make a vector V containing [1,2,3,4,5]
    print "hello world" and vector V
    print(myfunction(x))  // should print 9
  }$$
}
EXPORT: END

Run this script

glupe idea.txt -make -cloud -series

Full Control: You Drive, AI Fills

Unlike "all-or-nothing" AI generators, Glupe lets you decide exactly where AI touches your code:

You control structure, includes, and architecture AI only fills $${ ... }$$ blocks Perfect for production code where safety matters

Series Mode (Prevents Prompt Fatigue)

glupe project.glp -make -series

Generates files sequentially (not parallel) to ensure AI maintains context and delivers complete, coherent outputs.

Automatic Build Detection

Glupe automatically detects and runs your build system:

Makefile → runs make

CMakeLists.txt → configures and builds

build.sh / build.bat → executes directly

Failed build? Glupe retries with compiler feedback:

[Pass 1] Missing #include <map>
[Pass 2] Wide string mismatch  
[Pass 3] BUILD SUCCESSFUL!
glupe app.glp -o app.exe -cpp -local -run

Model-Agnostic Works with any LLM backend:

Local: Ollama (privacy, zero cost)

Cloud: OpenAI, Google Gemini (more power)

Custom: Any OpenAI-compatible API

Utility Commands

fix – Apply Smart Edits

Add changes to your code via natural language:

glupe fix project.c "fix segfault in line 1023" -local

explain – Auto-Generate Documentation

Create a thoroughly commented copy of your file:

glupe explain main.cpp -cloud english

Creates main_doc.cpp with detailed comments

diff – Semantic Change Analysis

Generate a Markdown report of what changed, not just what text changed:

glupe diff version1.py version2.py -cloud

Outputs human-readable change summary

sos – Terminal Tech Support

Get AI help without leaving your terminal:

glupe sos english -local "KeyError: 'name' in my pandas script"

Glupe is a semantic compiler that:

  • Parses EXPORT: blocks to create project files
  • Copies your literal code exactly as written
  • Lets AI fill only the $${ ... }$$ blocks you designate
  • Uses -series to build files sequentially (prevents AI fatigue)
  • Gives you full control—unlike black-box AI generators
  1. A different approach to build automation

Traditional build systems (Make, CMake, etc.) focus on compiling and linking source code you already wrote, since they won't write code for you. Glupe aims to help bridge the gap between intent and implementation by generating source code and build files based on a text description.

With CMake: you write configuration files and provide source code.

With Glupe: you describe what you want in plain text, and Glupe attempts to generate the source code and build scripts, then run the build.

  1. Faster prototyping (with caveats)

Glupe can accelerate early-stage prototyping by letting you express ideas in your own jargon or pseudo-code, then generating and compiling an initial implementation or MVP.

Input: Intent or pseudo-code Output: Source code and optionally a compiled binary

Note: Results depend on the model, the explicitness and quality of the input. The output may also require refinement. Glupe is not guaranteed to produce production-ready code. Treat the output Glupe makes as a fresh piece out of a 3D printer.

  1. Self-healing build loop

Glupe can reduce time spent debugging compilation errors by using an automated feedbacks loop:

A. Generate code B. Compile C. If the build fails, send the compiler output back to the model D. Retry (up to a configured number of attempts) This can help with common compilation issues, but it is not a replacement for understanding the underlying code or dependencies.

Setup Local AI (Privacy First)

glupe config model-local qwen2.5-coder:latest

Setup Cloud AI (Max Reasoning)

glupe config api-key "YOUR_KEY"
glupe config model-cloud gemini-1.5-flash
  1. Basic Compilation
glupe main.cpp -o app.exe -cpp -cloud

To set clear expectations:

  1. Not a compiler: It does not compile code itself. It relies on existing compilers and interpreters.
  2. Not deterministic: Output depends on the model and prompt, so results may vary between runs.
  3. Not a production build system: It does not track dependencies or perform incremental builds.
  4. Not a formal transpiler: It generates code via LLMs, not via syntax tree translation.

The Vision Programming has traditionally required years of study to master syntax and memory management. Glupe aims to lower the barrier of software engineering so a broader audience can access computational resources for their professional fields.

Glupe transforms the compiler from a syntax checker into a partner in creation.

https://github.com/alonsovm44/glupe/blob/master/.DOCUMENTATION/WHITE_PAPER.md

In the releases section https://github.com/alonsovm44/glupe-tutorial

Thanks very much for all contributions to Glupe

  • Alonso Velazquez (Mexico) since Jan 15 26
  • Krzysztof Dudek (Poland) since Feb 23 26
联系我们 contact @ memedata.com