Skip to content

使用swift实现LLVM教程中“我的第一门玩具语言”Kaleidoscope

License

Notifications You must be signed in to change notification settings

qyz777/Kaleidoscope

Repository files navigation

Kaleidoscope

参考My First Language Frontend with LLVM Tutorial的C++代码实现的swift版Kaleidoscope。

Kaleidoscope是LLVM教程中实现的demo语言,以下是它的介绍:

This tutorial introduces the simple “Kaleidoscope” language, building it iteratively over the course of several chapters, showing how it is built over time. This lets us cover a range of language design and LLVM-specific ideas, showing and explaining the code for it all along the way, and reduces the overwhelming amount of details up front. We strongly encourage that you work with this code - make a copy and hack it up and experiment.

运行工程的必要配置

下载llvm和pkg-config

brew install llvm
brew install pkg-config
# 在.bash_profile下配置llvm命令行,具体情况根据你所安装的llvm版本不同
export PATH=/usr/local/Cellar/llvm/8.0.0_1/bin:$PATH;

工程配置

# 来自LLVMSwift的脚本
swift utils/make-pkgconfig.swift
# 编译工程
swift build

测试

swift run
./Examples/test.k

开发教程

教你使用swift写编译器玩具(0)

教你使用swift写编译器玩具(1)

教你使用swift写编译器玩具(2)

教你使用swift写编译器玩具(3)

教你使用swift写编译器玩具(4)

教你使用swift写编译器玩具(5)

教你使用swift写编译器玩具(6)

教你使用swift写编译器玩具(7)

教你使用swift写编译器玩具(8)

About

使用swift实现LLVM教程中“我的第一门玩具语言”Kaleidoscope

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published