<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LLGo:基于LLVM的Go语言编译器前端</title>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Futura:wght@400;500;700&display=swap" rel="stylesheet">
<style>
/* 基础样式 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "HarmonyOS Sans SC", "PingFang HK", sans-serif;
background-color: #f8f9fa;
color: #1d3557;
line-height: 1.6;
}
/* 海报容器 */
.llgo-poster-container {
width: 960px;
margin: 0 auto;
background-color: #ffffff;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
overflow: visible;
}
/* 标题区域 */
.llgo-header {
background: linear-gradient(135deg, #457b9d, #1d3557);
color: white;
padding: 40px;
text-align: center;
}
.llgo-title {
font-family: "Futura", "DingTalk JinBuTi", sans-serif;
font-size: 48px;
font-weight: 700;
margin-bottom: 16px;
letter-spacing: -0.05em;
}
.llgo-subtitle {
font-size: 24px;
font-weight: 400;
opacity: 0.9;
}
/* 内容区域 */
.llgo-content {
padding: 40px;
}
.llgo-section {
margin-bottom: 40px;
}
.llgo-section-title {
font-family: "Futura", "DingTalk JinBuTi", sans-serif;
font-size: 32px;
color: #457b9d;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 2px solid #a8dadc;
display: flex;
align-items: center;
}
.llgo-section-title .material-icons {
margin-right: 12px;
font-size: 32px;
}
.llgo-text {
font-size: 18px;
margin-bottom: 16px;
}
/* 特性卡片 */
.llgo-features {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 24px;
margin-top: 24px;
}
.llgo-feature-card {
background-color: #f1faee;
border-radius: 8px;
padding: 24px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.llgo-feature-title {
font-size: 22px;
font-weight: 600;
color: #1d3557;
margin-bottom: 12px;
display: flex;
align-items: center;
}
.llgo-feature-title .material-icons {
margin-right: 8px;
color: #457b9d;
}
.llgo-feature-list {
list-style-type: none;
padding-left: 16px;
}
.llgo-feature-list li {
position: relative;
padding-left: 20px;
margin-bottom: 8px;
font-size: 16px;
}
.llgo-feature-list li:before {
content: "•";
position: absolute;
left: 0;
color: #457b9d;
font-weight: bold;
}
/* 代码块 */
.llgo-code-block {
background-color: #2b2d42;
color: #edf2f4;
border-radius: 8px;
padding: 20px;
margin: 20px 0;
overflow-x: auto;
font-family: "Futura", monospace;
font-size: 16px;
line-height: 1.5;
}
.llgo-code-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
color: #a8dadc;
font-size: 14px;
}
.llgo-code-content {
white-space: pre;
font-family: monospace;
}
/* 项目结构 */
.llgo-project-structure {
background-color: #f1faee;
border-radius: 8px;
padding: 24px;
margin-top: 20px;
}
.llgo-structure-list {
list-style-type: none;
font-family: monospace;
}
.llgo-structure-list li {
padding: 8px 0;
border-bottom: 1px dashed #a8dadc;
}
.llgo-structure-list li:last-child {
border-bottom: none;
}
/* 总结区域 */
.llgo-summary {
background: linear-gradient(135deg, #a8dadc, #457b9d);
color: white;
padding: 30px;
border-radius: 8px;
margin-top: 30px;
}
.llgo-summary-title {
font-size: 28px;
font-weight: 600;
margin-bottom: 16px;
}
.llgo-summary-list {
list-style-type: none;
}
.llgo-summary-list li {
margin-bottom: 12px;
padding-left: 24px;
position: relative;
}
.llgo-summary-list li:before {
content: "✓";
position: absolute;
left: 0;
font-weight: bold;
}
/* 链接样式 */
.llgo-link {
color: #457b9d;
text-decoration: none;
font-weight: 500;
}
.llgo-link:hover {
text-decoration: underline;
}
/* 响应式调整 */
<span class="mention-invalid">@media</span> (max-width: 960px) {
.llgo-poster-container {
width: 100%;
}
.llgo-features {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<div class="llgo-poster-container">
<!-- 标题区域 -->
<div class="llgo-header">
<h1 class="llgo-title">LLGo</h1>
<p class="llgo-subtitle">基于LLVM的Go语言编译器前端</p>
</div>
<!-- 内容区域 -->
<div class="llgo-content">
<!-- 简介 -->
<div class="llgo-section">
<h2 class="llgo-section-title">
<i class="material-icons">info</i>简介
</h2>
<p class="llgo-text">
LLGo 是一个基于 LLVM 的 Go 语言编译器前端,由 Go+ 项目团队发起,用 Go 语言实现。它的核心目标是"把 Go 无缝带进 C/Python 生态",为 Go 开发者提供更广阔的应用场景和更强大的性能优化能力。
</p>
</div>
<!-- 核心目标 -->
<div class="llgo-section">
<h2 class="llgo-section-title">
<i class="material-icons">track_changes</i>核心目标
</h2>
<p class="llgo-text">
LLGo 的核心目标是"把 Go 无缝带进 C/Python 生态",通过以下方式实现:
</p>
<ul class="llgo-feature-list">
<li>复用 LLVM 成熟的后端技术,提供高效的代码生成和优化能力</li>
<li>实现零成本调用 C/C++ 库,无需额外的包装层</li>
<li>支持动态导入 Python 模块,扩展 Go 的应用生态</li>
<li>保持与 Go 语言的高度兼容性,降低学习成本</li>
</ul>
</div>
<!-- 主要功能特性 -->
<div class="llgo-section">
<h2 class="llgo-section-title">
<i class="material-icons">stars</i>主要功能特性
</h2>
<div class="llgo-features">
<div class="llgo-feature-card">
<h3 class="llgo-feature-title">
<i class="material-icons">speed</i>编译与优化
</h3>
<ul class="llgo-feature-list">
<li>复用 LLVM 成熟的后端(支持 LLVM 18),可输出高效机器码或 WebAssembly</li>
<li>实验性支持"全局寄存器分配"等 LLVM 优化</li>
<li>计算密集场景(Fibonacci、排序)实测可比官方 gc 编译器提速 10–30%</li>
</ul>
</div>
<div class="llgo-feature-card">
<h3 class="llgo-feature-title">
<i class="material-icons">integration_instructions</i>零成本调用 C/C++
</h3>
<ul class="llgo-feature-list">
<li>通过 ABI 直接链入已安装的 .so/.dylib/.a,无需写 cgo、无需 C 包装层</li>
<li>已提供 raylib、sqlite、lua、libxml2 等常用库的"即引即用"包</li>
<li>附带代码生成工具 llcppg:解析头文件 ➜ 自动生成 Go 声明与类型映射</li>
</ul>
</div>
<div class="llgo-feature-card">
<h3 class="llgo-feature-title">
<i class="material-icons">python</i>动态导入 Python 模块
</h3>
<ul class="llgo-feature-list">
<li>内置 llpyg 工具,一行命令把 numpy、pandas、pytorch 等 Python 库"拉"进 Go 项目</li>
<li>运行时通过 CPython C-API 直接调用 Python 模块</li>
<li>无缝集成 Python 生态系统,扩展 Go 的数据处理能力</li>
</ul>
</div>
<div class="llgo-feature-card">
<h3 class="llgo-feature-title">
<i class="material-icons">code</i>对 Go 语法的支持度
</h3>
<ul class="llgo-feature-list">
<li>函数、闭包、goroutine、defer、接口等常用特性已能跑通</li>
<li>泛型、反射、部分标准库包仍在补齐</li>
<li>官方定位为"实验阶段",不建议直接上生产环境</li>
</ul>
</div>
</div>
</div>
<!-- 跨平台与构建 -->
<div class="llgo-section">
<h2 class="llgo-section-title">
<i class="material-icons">devices</i>跨平台与构建
</h2>
<p class="llgo-text">
LLGo 支持多种平台和架构,具有灵活的构建和发布方式:
</p>
<ul class="llgo-feature-list">
<li><strong>Host 支持:</strong>macOS、Linux(Windows 正在移植)</li>
<li><strong>目标平台:</strong>x86_64、ARM64、WebAssembly</li>
<li><strong>构建工具:</strong>采用 GoReleaser 统一发布,一条 make 即可本地编出 llgo 可执行文件</li>
</ul>
</div>
<!-- 典型用法速览 -->
<div class="llgo-section">
<h2 class="llgo-section-title">
<i class="material-icons">terminal</i>典型用法速览
</h2>
<div class="llgo-code-block">
<div class="llgo-code-header">
<span>bash</span>
</div>
<div class="llgo-code-content"># 安装(以 macOS 为例)
brew install llvm@18 pkg-config bdw-gc openssl python@3.12
git clone https://github.com/goplus/llgo && cd llgo
make
# 运行
./llgo run main.go
# 编译独立可执行文件
./llgo -o hello hello.go</div>
</div>
</div>
<!-- 项目结构与学习入口 -->
<div class="llgo-section">
<h2 class="llgo-section-title">
<i class="material-icons">folder</i>项目结构与学习入口
</h2>
<div class="llgo-project-structure">
<ul class="llgo-structure-list">
<li><strong>cmd/llgo/main.go</strong> —— 编译器入口</li>
<li><strong>_demo / _pydemo</strong> —— C 与 Python 互操作示例</li>
<li><strong>doc/How-to-support-a-C&C++-Library.md</strong> —— 自写 C 库绑定教程</li>
<li><strong>官网仓库(GitHub):</strong><a href="https://github.com/goplus/llgo" class="llgo-link">https://github.com/goplus/llgo</a></li>
</ul>
</div>
</div>
<!-- 总结 -->
<div class="llgo-summary">
<h2 class="llgo-summary-title">总结</h2>
<p class="llgo-text">
LLGo 不是官方编译器的替代品,而是"Go + C + Python"三栖场景的加速器。如果你需要:
</p>
<ul class="llgo-summary-list">
<li>在 Go 里直接调用现成 C 库/Python 模型</li>
<li>把 Go 跑在 WebAssembly、嵌入式或高性能计算环境</li>
<li>体验 LLVM 带来的优化潜力</li>
</ul>
<p class="llgo-text" style="margin-top: 16px;">
那么 LLGo 值得拉下来试跑一波。
</p>
</div>
</div>
</div>
</body>
</html>
登录后可参与表态
讨论回复
1 条回复
QianXun (QianXun)
#1
02-17 15:12
登录后可参与表态