Kylix 入门教程
版本:v3.0.0-alpha
难度:零基础友好
预计阅读+实践时间:30 分钟
所有示例代码均已在 macOS/Linux 上实际编译运行通过
前言:为什么写这篇教程
Kylix 是一个现代 Pascal 语言,编译到 Go,兼具 Pascal 的清晰优雅和 Go 的性能与生态。v3.0.0-alpha 是 Kylix 的里程碑版本------LLVM 原生后端、WASI 支持、包注册中心、纯 Kylix 标准库 Phase 4,架构级突破全面落地。
但再好的语言,第一步永远是:怎么把它跑起来?
这篇文章不做概念堆砌,只做一件事:带你从一个完全干净的环境开始,编译出 Kylix 编译器,创建第一个项目,写出第一个程序,然后逐步掌握变量、控制流、函数、记录、数组、异常处理等核心语法。所有代码示例都是我亲手在 v3.0.0-alpha 上跑通的,遇到的坑也会直接告诉你。
第一章:环境准备与编译安装
1.1 前置依赖
Kylix 编译到 Go,所以你需要先安装 Go 环境:
| 依赖 | 版本要求 | 安装方式 |
|---|---|---|
| Go | 1.18+(推荐 1.21+ 以支持 WASI) | macOS: brew install go;Linux: 包管理器或官网下载 |
| Git | 任意版本 | macOS: brew install git;Linux: 预装 |
| LLVM(可选) | 14+ | 仅使用 LLVM 原生后端时需要:brew install llvm |
验证安装:
$ go version
go version go1.26.3 darwin/arm64
$ git --version
git version 2.x.x
1.2 获取源码并编译
这是最关键的一步。网上很多教程会漏掉 go mod tidy,导致编译失败------我在干净环境实测了完整流程,按这个来一定能成:
# 1. 克隆仓库
git clone https://github.com/astra-zhao/kylix.git
cd kylix
# 2. 拉取依赖(必须!缺失会报 "missing go.sum entry" 错误)
go mod tidy
# 3. 编译编译器
go build -o kylix ./cmd/kylix/
# 4. 验证编译成功
./kylix version
# 输出:Kylix 3.0.0-alpha
坑点提醒 :如果你直接
go build -o kylix cmd/kylix/main.go会报undefined: cmdBuild等错误------那是因为 main.go 依赖同目录下其他文件,要用./cmd/kylix/(目录路径)而不是单个文件。
1.3 加入 PATH(可选)
为了在任何目录都能使用 kylix 命令,把它加入 PATH:
# 临时生效(当前终端)
export PATH=$PATH:$(pwd)
# 永久生效(zsh 用户)
echo 'export PATH=$PATH:'"$(pwd)" >> ~/.zshrc
source ~/.zshrc
1.4 验证:Hello World 一行命令
编译成功后,立即验证一下:
$ ./kylix run examples/complete-tutorial/01_basics/example01_hello.klx
Hello, Kylix World!
Welcome to modern Pascal programming!
Kylix is a modern Pascal-to-Go transpiler
如果你看到了三行输出------恭喜,Kylix 已经在你机器上跑起来了!
1.5 LLVM 后端(可选)
如果你安装了 LLVM(macOS: brew install llvm),可以尝试原生后端:
# 把 LLVM 加入 PATH(macOS Homebrew 安装的 LLVM 需要这步)
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
# 用 LLVM 后端编译(生成原生二进制,不依赖 Go runtime)
./kylix build --backend=llvm examples/complete-tutorial/01_basics/example01_hello.klx
生成的原生二进制只有约 33KB,对比 Go 后端的 2MB,体积缩小约 60 倍。目前 LLVM 后端是 Milestone 1,支持标量类型、控制流、函数、类 vtable;接口、泛型、异常等会在 Milestone 2 补齐。Go 后端仍然是默认和推荐的生产环境后端。
第二章:CLI 命令一览
v3.0.0-alpha 共有 19 个 CLI 命令,日常开发最常用的就几个:
| 命令 | 作用 | 类比 |
|---|---|---|
kylix new <name> |
创建新项目 | cargo new / npm init |
kylix build |
编译(默认 Go 后端) | go build |
kylix build --wasm |
编译为浏览器 WebAssembly | |
kylix build --wasi |
编译为 WASI(服务端/边缘计算) | |
kylix build --backend=llvm |
编译为 LLVM 原生二进制 | |
kylix run |
编译并运行 | go run |
kylix check |
语法/类型检查(不生成代码) | tsc --noEmit |
kylix fmt |
格式化代码 | gofmt / prettier |
kylix test |
运行测试(*_test.klx 中的 Test* 过程) |
go test |
kylix bench |
运行基准测试(Bench* 过程) |
go test -bench |
kylix repl |
交互式解释器 | python / node |
kylix lsp |
启动 LSP 服务器(给编辑器用) | |
kylix publish |
发布包到注册中心 | npm publish |
kylix version |
查看版本 | |
kylix help |
查看帮助 |
第三章:第一个项目
3.1 创建项目
$ ./kylix new myapp
✓ Created project 'myapp' in myapp/
Run 'cd myapp && kylix run' to get started
$ cd myapp
$ ls -la
total 24
drwx------ .gitignore
drwx------ build/ # 编译输出目录
-rw------- kylix.toml # 项目配置
-rw------- main.klx # 主程序入口
3.2 项目配置
kylix.toml 是项目配置文件:
# Kylix project configuration
[project]
name = "myapp"
version = "1.2.2"
main = "main.klx"
[build]
output = "build/"
go_module = "myapp"
3.3 默认 main.klx
program myapp;
// Entry point for the myapp project
begin
WriteLn('Hello from myapp!');
end.
3.4 运行项目
$ kylix run
Hello from myapp!
就这么简单------项目创建到运行,不到 30 秒。
第四章:循序渐进写代码(8个可运行示例)
下面的所有示例都可以保存为 .klx 文件,用 kylix run 文件名.klx 直接运行。我已经全部实测通过。
示例 1:Hello World ------ 程序的基本结构
program HelloWorld;
begin
WriteLn('Hello, Kylix!');
WriteLn('Welcome to modern Pascal programming.');
end.
运行:
$ kylix run 01_hello.klx
Hello, Kylix!
Welcome to modern Pascal programming.
知识点:
-
•
program 名称;声明程序名(可选,但建议写) -
•
begin...end.是程序体,end.末尾有个点------这是 Pascal 的经典语法,别忘了 -
•
WriteLn(...)是输出函数,相当于 Go 的fmt.Println -
• 每行语句以分号
;结尾
示例 2:变量与类型 ------ 数据的基础
Kylix 是强类型语言,但支持类型推导。
program Variables;
var
name: String; // 字符串
age: Integer; // 64位整数
height: Real; // 64位浮点数
isStudent: Boolean; // 布尔值
begin
// 显式类型变量的赋值
name := 'Alice';
age := 25;
height := 1.68;
isStudent := true;
WriteLn('Name: ', name);
WriteLn('Age: ', age);
WriteLn('Height: ', height);
WriteLn('Student: ', isStudent);
// 类型推导(现代 Pascal 特性!)
// 使用 := 时编译器自动推断类型
var count := 100; // 推断为 Integer
var greeting := 'Hello'; // 推断为 String
var pi := 3.14159; // 推断为 Real
WriteLn('Inferred count = ', count, ', greeting = ', greeting, ', pi = ', pi);
end.
运行输出:
Name: Alice
Age: 25
Height: 1.68
Student: true
Inferred count = 100 , greeting = Hello , pi = 3.14159
知识点:
-
• 变量声明在
var块中,格式:变量名: 类型; -
• 赋值用
:=(Pascal 经典语法),不是=(=在 Pascal 中是比较运算符) -
•
var x := 值是现代特性,自动类型推导,不用写类型 -
• 五个基础类型:
Integer(int64)、Real(float64)、Boolean、String、Char
示例 3:控制流 ------ 分支与循环
程序不只是线性执行,还需要判断和循环。
program ControlFlow;
var
i: Integer;
score: Integer;
begin
// ========== if-else 分支 ==========
score := 85;
if score >= 90 then
WriteLn('Grade: A')
else if score >= 80 then
WriteLn('Grade: B')
else if score >= 60 then
WriteLn('Grade: C')
else
WriteLn('Grade: F');
// ========== for 循环(计数循环)==========
WriteLn('--- Counting 1 to 5 ---');
for i := 1 to 5 do
WriteLn(' i = ', i);
// for 还可以 downto 倒序
WriteLn('--- Counting down ---');
for i := 5 downto 1 do
WriteLn(' ', i);
// ========== while 循环(条件循环)==========
WriteLn('--- While countdown ---');
i := 3;
while i > 0 do
begin
WriteLn(' ', i);
i := i - 1;
end;
WriteLn(' Go!');
// ========== repeat-until(先执行后判断)==========
WriteLn('--- Repeat until ---');
i := 0;
repeat
WriteLn(' iteration ', i);
i := i + 1;
until i >= 3;
// ========== case 多分支选择 ==========
WriteLn('--- Day of week ---');
i := 3;
case i of
1: WriteLn('Monday');
2: WriteLn('Tuesday');
3: WriteLn('Wednesday');
4: WriteLn('Thursday');
5: WriteLn('Friday');
end;
end.
运行输出:
Grade: B
--- Counting 1 to 5 ---
i = 1
i = 2
i = 3
i = 4
i = 5
--- Counting down ---
5
4
3
2
1
--- While countdown ---
3
2
1
Go!
--- Repeat until ---
iteration 0
iteration 1
iteration 2
--- Day of week ---
Wednesday
知识点:
-
•
if 条件 then ... else ...------注意 else 前面没有分号!这是 Pascal 的语法规则:if-else 是一个完整语句,中间不能有分号断开 -
• 多条语句用
begin...end包裹,相当于其他语言的{ } -
•
for i := start to end do是正向循环,downto是反向 -
•
while 条件 do先判断后执行,可能一次都不执行 -
•
repeat...until 条件先执行后判断,至少执行一次 -
•
case 表达式 of 值1: ...; 值2: ...; end;相当于 switch-case
示例 4:函数与过程 ------ 代码复用
Kylix 区分两种可调用单元:
-
• function:有返回值
-
• procedure:无返回值
program Functions;
// 函数:有返回值,返回类型在冒号后声明
function Add(a: Integer; b: Integer): Integer;
begin
result := a + b; // result 是特殊变量,代表返回值
end;// 递归函数:调用自己
function Factorial(n: Integer): Integer;
begin
if n <= 1 then
result := 1
else
result := n * Factorial(n - 1);
end;// 多返回值:元组语法(现代 Pascal 特性)
function DivMod(a: Integer; b: Integer): (Integer, Integer);
begin
result := (a div b, a mod b); // div 是整除,mod 是取模
end;// 主程序
var
// 多返回值解构
(quotient, remainder) := DivMod(17, 5);
begin
WriteLn('------------------------');
WriteLn('Add(3, 4) = ', Add(3, 4));
WriteLn('Factorial(6) = ', Factorial(6));
WriteLn('17 div 5 = ', quotient, ', remainder = ', remainder);
WriteLn('------------------------');
end.
运行输出:
------------------------
Add(3, 4) = 7
Factorial(6) = 720
17 div 5 = 3 , remainder = 2
------------------------
知识点:
-
• 函数声明格式:
function 名称(参数列表): 返回类型; -
• 使用特殊变量
result设置返回值(类似 Go 的具名返回值) -
•
div是整数除法,/是浮点数除法,mod是取模 -
• 多返回值用
(类型1, 类型2)语法,解构时用var (a, b) := Func() -
• 过程(procedure)和函数类似,但没有返回类型和
result
示例 5:记录与数组 ------ 组织复杂数据
当基础类型不够用时,用 record(类似 struct)和数组组合数据。
program RecordsAndArrays;
type
// 记录类型(类似 C struct / Go struct)
TPerson = record
Name: String;
Age: Integer;
Score: Real;
end;
var
// 静态数组:长度固定 [0..2] 表示下标从0到2
people: array[0..2] of TPerson;
i: Integer;
begin
// 给记录字段赋值
people[0].Name := 'Alice';
people[0].Age := 25;
people[0].Score := 92.5;
people[1].Name := 'Bob';
people[1].Age := 22;
people[1].Score := 78.0;
people[2].Name := 'Charlie';
people[2].Age := 28;
people[2].Score := 88.5;
WriteLn('=== People ===');
for i := 0 to 2 do
begin
WriteLn(people[i].Name, ' (', people[i].Age, ') - Score: ', people[i].Score);
end;
// ========== 动态数组 ==========
// 动态数组长度可变,用 append 添加元素
var names: array of String;
names := nil; // 初始化空数组
append(names, 'Alice');
append(names, 'Bob');
append(names, 'Charlie');
WriteLn('');
WriteLn('Dynamic array length: ', Length(names));
for i := 0 to Length(names) - 1 do
WriteLn(' names[', i, '] = ', names[i]);
// ========== Map 类型(哈希表)==========
var scores: map[String]Real;
scores['math'] := 95.0;
scores['english'] := 87.5;
scores['physics'] := 91.0;
WriteLn('');
WriteLn('Math score: ', scores['math']);
WriteLn('English score: ', scores['english']);
end.
运行输出:
=== People ===
Alice ( 25 ) - Score: 92.5
Bob ( 22 ) - Score: 78
Charlie ( 28 ) - Score: 88.5
Dynamic array length: 3
names[ 0 ] = Alice
names[ 1 ] = Bob
names[ 2 ] = Charlie
Math score: 95
English score: 87.5
知识点:
-
•
type 名称 = record 字段... end;定义记录类型 -
• 用
.访问记录字段:person.Name -
• 静态数组:
array[起始..结束] of 类型,长度固定 -
• 动态数组:
array of 类型,配合append(arr, item)和Length(arr)使用 -
• Map 类型:
map[键类型]值类型,用map[key]读写
示例 6:异常处理 ------ 优雅处理错误
程序难免出错,Kylix 提供了 try-except-finally 机制。
program Exceptions;
function SafeDivide(a: Integer; b: Integer): Integer;
begin
if b = 0 then
raise Exception.Create('Division by zero'); // 抛出异常
result := a div b;
end;
begin
// ========== try-except:捕获异常 ==========
try
WriteLn('10 / 2 = ', SafeDivide(10, 2));
WriteLn('10 / 0 = ', SafeDivide(10, 0)); // 这里会抛异常
except
on E: Exception do
WriteLn('Error caught: ', E.Message);
end;
// ========== try-finally:确保清理 ==========
// finally 块无论是否异常都会执行,适合关闭文件、释放资源
WriteLn('');
WriteLn('Opening resource...');
try
WriteLn('Using resource...');
finally
WriteLn('Resource always closed (cleanup)');
end;
WriteLn('Done.');
end.
运行输出:
10 / 2 = 5
Error caught: Division by zero
Opening resource...
Using resource...
Resource always closed (cleanup)
Done.
知识点:
-
•
raise Exception.Create('错误信息')抛出异常 -
•
try...except on E: Exception do 处理...end;捕获特定类型异常 -
•
try...finally 清理代码 end;保证清理代码总是执行(即使发生异常) -
• except 和 finally 可以组合使用:
try...except...finally...end;
示例 7:类与面向对象(当前版本注意事项)
Kylix 支持面向对象编程:类、继承、虚函数等。
注意 :v3.0.0-alpha 的 Go 代码生成器中,类方法体内访问字段存在一个已知 bug(缺少
self.前缀,导致编译错误)。带参数的构造函数可以正常工作。下面是一个概念示例,展示类的语法结构:
program ClassConcept;
type
// 类声明语法(概念演示,当前 Go 后端有已知 bug)
TAnimal = class
private
Name: String;
public
constructor Create(name: String);
procedure Speak; virtual;
end;
TDog = class(TAnimal)
public
procedure Speak; override;
end;
begin
WriteLn('=== Class Syntax Reference ===');
WriteLn('Kylix supports classes, inheritance, virtual/override.');
WriteLn('');
WriteLn('Class syntax:');
WriteLn(' type TMyClass = class');
WriteLn(' private');
WriteLn(' field: Type;');
WriteLn(' public');
WriteLn(' constructor Create(params);');
WriteLn(' procedure Method;');
WriteLn(' function Func: ReturnType;');
WriteLn(' end;');
WriteLn('');
WriteLn('Inheritance: class Child inherits Parent');
WriteLn('Virtual methods: virtual / override keywords');
WriteLn('');
WriteLn('Note: Go backend field access in methods is being fixed.');
WriteLn('LLVM backend class support is in Milestone 1.');
end.
运行:
$ kylix run 07_classes.klx
=== Class Syntax Reference ===
Kylix supports classes, inheritance, virtual/override.
...
面向对象特性一览:
| 特性 | 语法 |
|---|---|
| 类声明 | type T = class ... end; |
| 访问控制 | private / public |
| 构造函数 | constructor Create(...) |
| 继承 | class Child inherits Parent |
| 虚函数 | procedure Foo; virtual; |
| 重写 | procedure Foo; override; |
| 创建实例 | obj := TMyClass.Create(...) |
| 调用方法 | obj.Method() |
示例 8:综合实战 ------ 数字猜谜游戏
把前面学的全部组合起来,写一个小程序:
program NumberGuesser;
// 综合示例:变量、控制流、函数、I/O
var
target: Integer;
guess: Integer;
attempts: Integer;
maxNum: Integer;
function Abs(x: Integer): Integer;
begin
if x < 0 then
result := -x
else
result := x;
end;
begin
maxNum := 100;
target := 42; // 实际使用中可以引入随机数,这里固定便于演示
attempts := 0;
WriteLn('=== Number Guessing Game ===');
WriteLn('I am thinking of a number between 1 and ', maxNum);
WriteLn('');
// 模拟一次猜测
guess := 50;
attempts := attempts + 1;
WriteLn('Guess #', attempts, ': ', guess);
if guess < target then
WriteLn('Too low!')
else if guess > target then
WriteLn('Too high!')
else
WriteLn('Correct!');
// 距离提示
var diff := Abs(guess - target);
if diff <= 5 then
WriteLn('(Very close!)')
else if diff <= 20 then
WriteLn('(Getting warm)')
else
WriteLn('(Cold)');
WriteLn('');
WriteLn('Thanks for playing!');
end.
运行输出:
=== Number Guessing Game ===
I am thinking of a number between 1 and 100
Guess # 1 : 50
Too high!
(Getting warm)
Thanks for playing!
第五章:标准库速览
v3.0.0-alpha 内置了丰富的标准库,用 uses 模块名; 导入:
| 模块 | 用途 | 示例 |
|---|---|---|
web |
HTTP 服务器、路由、中间件 | Web 应用、REST API |
orm |
数据库 ORM(MySQL/PostgreSQL/SQLite) | 数据持久化 |
jsonutil |
JSON 编解码(v3.0 纯 Kylix 实现嵌套解析) | API 数据交换 |
datetime |
日期时间运算、格式化(v3.0 纯 Kylix 实现) | 时间处理 |
regex |
正则匹配、邮箱/URL/IP 验证(v3.0 纯 Kylix 实现) | 输入验证 |
sysutil |
文件读写、目录操作、路径工具 | 文件 I/O |
httpclient |
HTTP 客户端(v3.0 新增) | 发送 HTTP 请求 |
wasi |
WASI 系统接口(v3.0 新增) | WebAssembly 环境 |
container |
依赖注入容器 | 架构解耦 |
config |
配置管理(环境变量等) | 应用配置 |
template |
HTML 模板引擎 | 服务端渲染 |
validation |
请求验证 | 参数校验 |
middleware |
Web 中间件(CORS、Auth、限流等) | Web 中间件 |
iter |
数组迭代工具(Contains/Count/Unique/Reverse等) | 集合操作 |
strutil /mathutil/arrayutil |
字符串/数学/数组工具函数 | 常用工具 |
标准库示例:HTTP 服务器
program WebApp;
uses web;
var
app: TServer;
begin
app := web.createServer(8080);
// 简单 GET 路由
app.get('/', procedure(req: TRequest; res: TResponse)
begin
res.send('Hello from Kylix Web Server!');
end);
// 带路径参数的 API
app.get('/api/hello/:name', procedure(req: TRequest; res: TResponse)
var
name: String;
begin
name := req.param('name');
res.send('Hello, ' + name + '!');
end);
WriteLn('Server starting on http://localhost:8080');
app.listen();
end.
标准库示例:JSON 处理
program JsonDemo;
uses jsonutil;
var
obj: map[String]interface{};
begin
// 解析 JSON 字符串
obj := jsonutil.JsonDecodeMap('{"name": "Kylix", "version": 3, "active": true}');
// 类型安全读取
WriteLn('Name: ', jsonutil.JsonGetString(obj, 'name'));
WriteLn('Version: ', jsonutil.JsonGetInt(obj, 'version'));
WriteLn('Active: ', jsonutil.JsonGetBool(obj, 'active'));
end.
第六章:编辑器配置
Kylix 内置 LSP 服务器,支持任何兼容 LSP 的编辑器:
VS Code
仓库自带 VS Code 扩展:
cd vscode-ext
npm install
# 按 F5 启动扩展开发宿主
功能:语法高亮、括号匹配、代码折叠、自动补全、悬停提示、诊断。
其他编辑器(Neovim/Emacs/Sublime等)
配置 LSP 客户端启动 kylix lsp:
{
"command": ["kylix", "lsp"],
"filetypes": ["kylix"]
}
第七章:故障排除(踩坑总结)
我在实测中遇到的常见问题,以及解决方法:
问题 1:编译时报 missing go.sum entry
pkg/repl/repl.go:17:2: missing go.sum entry for module providing package github.com/peterh/liner
解决 :在仓库根目录执行 go mod tidy。
问题 2:go build cmd/kylix/main.go 报 undefined 错误
cmd/kylix/main.go:20:3: undefined: cmdBuild
解决 :编译整个目录而不是单个文件:go build -o kylix ./cmd/kylix/
问题 3:if-else 中 else 前多了分号
if score >= 60 then
WriteLn('Pass'); // ← 这里不应该有分号!
else
WriteLn('Fail');
解决 :Pascal 中 if...then...else 是一个完整语句,then 子句和 else 之间不能有分号。
问题 4:类方法中访问字段报 undefined
07_classes.klx:10: undefined: Name
原因 :v3.0.0-alpha 的 Go 后端生成器中,方法体内字段访问缺少 self. 前缀,这是一个已知 bug,已在路线图中。
解决:当前版本避免在类方法体内直接访问 private 字段,或使用带参数的构造函数(这部分工作正常)。
问题 5:map 使用前未初始化报 panic
panic: assignment to entry in nil map
解决:map 使用前需要初始化(Go 的 map 零值是 nil),或确保框架已初始化。Web 框架中的 map 已由框架处理。
问题 6:kylix version 显示旧版本
解决 :重新编译 go build -o kylix ./cmd/kylix/,确保你运行的是刚编译的新版本(用 ./kylix version 而不是系统 PATH 中的旧版本)。
第八章:学习路径与资源
初学者路径(1-3天)
-
- ✅ 完成本文所有 8 个示例
-
- 阅读
examples/complete-tutorial/中的 23 个官方示例
- 阅读
-
- 尝试
kylix repl交互式探索
- 尝试
-
- 用
kylix new创建项目开始小练习
- 用
进阶路径(1-2周)
-
- 学习类、接口、泛型
-
- 使用
web标准库写一个 REST API
- 使用
-
- 使用
orm连接数据库
- 使用
-
- 尝试
kylix test写单元测试
- 尝试
-
- 配置 VS Code LSP 获得 IDE 体验
高级路径(2周+)
-
- 阅读源码:
lexer/、parser/、generator/、pkg/compiler/
- 阅读源码:
-
- 尝试 LLVM 后端
--backend=llvm
- 尝试 LLVM 后端
-
- 尝试 WASI 编译
--wasi
- 尝试 WASI 编译
-
- 阅读
docs/下的开发者指南和架构文档
- 阅读
-
- 给项目贡献代码(修复 bug、添加文档、写示例)
官方资源
-
• GitHub:https://github.com/astra-zhao/kylix
-
• 官网:https://kylix.top
-
• CHANGELOG.md:版本更新日志
-
• ROADMAP.md:开发路线图
-
• examples/complete-tutorial/:23个官方示例
-
• docs/:IDE手册、开发者指南、Web框架指南、ORM指南
结语:Pascal 的现代重生
Pascal 是一门有着 50 多年历史的经典语言,以清晰的语法和严谨的结构影响了整整几代程序员。Kylix 没有把 Pascal 做成博物馆里的古董,而是给它注入了现代语言的血液:类型推导、泛型、Lambda、async/await、模式匹配、字符串插值,同时保留了 Pascal 最珍贵的特质------代码即文档的清晰感。
v3.0.0-alpha 不是终点,而是起点。LLVM 后端让它有了脱离 Go runtime 独立存在的能力,WASI 让它跑进了浏览器和边缘计算,包注册中心让生态有了生长的土壤。
最重要的是,它已经可以用了。编译一个编译器,写一个 Hello World,跑一个 Web 服务器------这些都不是画饼,而是今天就能做到的事情。
Programs should be written for people to read, and only incidentally for machines to execute.
------ Harold Abelson, SICP
Pascal 天生为可读性而生。Kylix 把这份初心带到了 2026 年。
现在,编译器已经在你手上。去写点什么吧。
本文所有示例代码均在 Kylix v3.0.0-alpha (Go backend) 上实际编译运行通过。最后更新:2026-06-21。