https://github.com/yianandcode/pineapple-c
https://github.com/yianandcode/pineapple-c
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/yianandcode/pineapple-c
- Owner: YianAndCode
- License: mit
- Created: 2021-02-23T17:25:08.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-12-05T16:40:43.000Z (over 4 years ago)
- Last Synced: 2025-03-29T04:47:36.808Z (about 1 year ago)
- Language: C
- Size: 47.9 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PINEAPPLE
pineapple lang 是一个简单的编程语言 demo。它包含了个手写的递归下降解析器和一个简单的解释器。虽然该语言甚至不是图灵完备的。但 pineapple 的主要目的是让编译原理初学者有一个预热,简单了解一个编程语言是怎么构建的。
**本项目是 pineapple lang 的 C 实现**
## 编译&运行
*注意,由于使用了 `regex.h` 库,在 Windows 下的编译可能会不通过*
```bash
# 把依赖拉取到本地
git submodule init && git submodule update
# 创建编译目录
mkdir build && cd build
# 使用 cmake 生成 Makefile
cmake ..
# 编译
make
# 运行
./pineapple-c ../examples/hello-world.pineapple
```
## 小教程
### GitHub
- [write-a-programming-language-in-450-lines](https://github.com/karminski/write-a-programming-language-in-450-lines)
### 知乎专栏
- [牙医教你 450 行代码自制编程语言 - 1, 从 EBNF 开始](https://zhuanlan.zhihu.com/p/341405385)
- [牙医教你 450 行代码自制编程语言 - 2, 两个魔法就可以实现永动机](https://zhuanlan.zhihu.com/p/341532964)
- [牙医教你 450 行代码自制编程语言 - 3, 实现 Lexer 上篇](https://zhuanlan.zhihu.com/p/341840788)
- [牙医教你 450 行代码自制编程语言 - 4, 实现 Lexer 下篇](https://zhuanlan.zhihu.com/p/342036670)
- [牙医教你 450 行代码自制编程语言 - 5, 递归下降语法解析器](https://zhuanlan.zhihu.com/p/342333858)
- [牙医教你 450 行代码自制编程语言 - 6, 后端](https://zhuanlan.zhihu.com/p/342457860)
- [牙医教你 450 行代码自制编程语言 - 7, 后续该如何学习编译原理](https://zhuanlan.zhihu.com/p/342982862)
## 贡献者
- [karminski-牙医](https://github.com/karminski)
- [Y!an](https://github.com/YianAndCode)
## 开源协议
- [MIT](LICENSE)