Skip to content

Commit 3a074b4

Browse files
author
WuK
authored
12.0.0.20230529: update to debian:bookworm (#117)
* Docker image 瘦身 * fix Dockerfile * fix workflow * rm Symbolic Link * add file * Revert "Docker image 瘦身" * 12.0.0.20230529: update to debian:bookworm (#113) 1. 更新实验环境为 `debian:bookworm`、`clang-14`、`llvm-14` 2. 重构 `lib1. 更新实验环境为 `debian:bookworm`、`clang-14`、`llvm-14` 2. 重构 `librarian` 目录 3. 调整 `cmake_minimum_required`,与 `llvm-14` 对齐 4. 调整文档 5. 修复 #74 rarian` 目录 3. 调整 `cmake_minimum_required`,与 `llvm-14` 对齐 4. 调整文档 5. 修复 #74
1 parent c4ea7b1 commit 3a074b4

File tree

34 files changed

+62
-55
lines changed

34 files changed

+62
-55
lines changed

.github/workflows/docker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
context: .
5656
tags: ${{ steps.meta.outputs.tags }}
5757
labels: ${{ steps.meta.outputs.labels }}
58-
build-args: BASE_IMAGE=debian:11
58+
build-args: BASE_IMAGE=debian:bookworm
5959

6060
- name: Build Docker image for unstable-slim
6161
if: github.ref_name == 'unstable-slim' || github.base_ref == 'unstable-slim'
@@ -91,7 +91,7 @@ jobs:
9191
context: .
9292
tags: ${{ steps.meta.outputs.tags }}
9393
labels: ${{ steps.meta.outputs.labels }}
94-
build-args: BASE_IMAGE=debian:11
94+
build-args: BASE_IMAGE=debian:bookworm
9595
platforms: linux/amd64,linux/arm64/v8
9696

9797
- name: Build and push Docker image for unstable-slim

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
cmake_minimum_required(VERSION 3.18.4)
2-
project(SYsU-lang VERSION 11.1.0.20230227)
1+
# <https://github.com/llvm/llvm-project/blob/llvmorg-14.0.6/llvm/CMakeLists.txt>
2+
cmake_minimum_required(VERSION 3.13.4)
3+
project(SYsU-lang VERSION 12.0.0.20230529)
34
include(CPack)
45
include(CTest)
56
add_subdirectory(compiler)

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ SYsU 是一个教学语言,应用于中山大学(**S**un **Y**at-**s**en **U
1111

1212
## 编译运行
1313

14-
需要注意的是,[SysY](https://gitlab.eduxiji.net/nscscc/compiler2021/-/blob/master/SysY%E8%AF%AD%E8%A8%80%E5%AE%9A%E4%B9%89.pdf) 语言允许编译时能够求值的 `const int` 作为数组大小,导致部分算例不能通过 `gcc` 的编译,因此为保持兼容推荐使用 `clang` 编译。经过测试的实验环境为 `debian:11`
14+
需要注意的是,[SysY](https://gitlab.eduxiji.net/nscscc/compiler2021/-/blob/master/SysY%E8%AF%AD%E8%A8%80%E5%AE%9A%E4%B9%89.pdf) 语言允许编译时能够求值的 `const int` 作为数组大小,导致部分算例不能通过 `gcc` 的编译,因此为保持兼容推荐使用 `clang` 编译。经过测试的实验环境为 `debian:bookworm`
1515

1616
```bash
1717
# 安装依赖
1818
sudo apt-get install -y --no-install-recommends \
1919
clang llvm-dev zlib1g-dev lld flex bison \
2020
cmake python3 ninja-build git
2121

22-
git clone https://github.com/arcsysu/SYsU-lang
22+
git clone \
23+
-c feature.manyFiles=true \
24+
--depth=1 \
25+
https://github.com/arcsysu/SYsU-lang
26+
2327
cd SYsU-lang
2428

2529
# 编译安装
@@ -307,7 +311,7 @@ entry:
307311
大算例以 `git submodule` 的形式存放在 `tester/third_party`。加载方式:
308312

309313
```bash
310-
git submodule update --init
314+
git submodule update --init --recursive --depth 1
311315
```
312316

313317
## 实验反馈
@@ -347,7 +351,7 @@ git submodule update --init
347351

348352
目前本项目存在两个分支:
349353

350-
- [`latest`](https://github.com/arcsysu/SYsU-lang/tree/latest) 分支下为中大课程教学中使用的代码,功能稳定,预期在 `debian:11` 环境中工作。
354+
- [`latest`](https://github.com/arcsysu/SYsU-lang/tree/latest) 分支下为中大课程教学中使用的代码,功能稳定,预期在 `debian:bookworm` 环境中工作。
351355
- [`unstable-slim`](https://github.com/arcsysu/SYsU-lang/tree/unstable-slim) 分支下为助教探索后续实验改革方案(如 mlir)的代码,预期在`debian:unstable-slim` 环境中工作。该分支中的文档可能不会及时更新,以对应 [Dockerfile](https://github.com/arcsysu/SYsU-lang/blob/unstable-slim/Dockerfile) 中的测试语句为准。
352356

353357
对于中大以外的高校教学者与个人自学者,我们建议使用 [releases](https://github.com/arcsysu/SYsU-lang/releases) 中最新发布的实验框架源码以及对应版本号的 [docker image](https://hub.docker.com/r/wukan0621/sysu-lang)。它们可能在时间上略有落后,但经过了中大一学期的教学检验,不存在潜在的可能导致教学事故的错误。我们也十分欢迎来自你们的课堂反馈[![Discussions](https://img.shields.io/github/discussions/arcsysu/SYsU-lang)](https://github.com/arcsysu/SYsU-lang/discussions) 与改进建议[![Issues](https://img.shields.io/github/issues/arcsysu/SYsU-lang)](https://github.com/arcsysu/SYsU-lang/issues)[![Issues-pr](https://img.shields.io/github/issues-pr/arcsysu/SYsU-lang)](https://github.com/arcsysu/SYsU-lang/pulls) 请提交至 `unstable-slim` 分支)。

generator/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ $ echo $? # 在 Unix & Linux 中,可以通过 echo $? 来查看最后运行的
135135

136136
## 你可能会感兴趣的
137137

138-
- [Kaleidoscope: Code generation to LLVM IR](https://releases.llvm.org/11.0.1/docs/tutorial/MyFirstLanguageFrontend/LangImpl03.html)
138+
- [Kaleidoscope: Code generation to LLVM IR](https://releases.llvm.org/14.0.0/docs/tutorial/MyFirstLanguageFrontend/LangImpl03.html)
139139
- [SYsU-lang 实验三快速上手](https://www.yuque.com/shuitang/rra4fg/bnqy1c)
140140
- [Viz.js — Graphviz in your browser.](http://viz-js.com/)
141-
- [llvm::IRBuilder](https://github.com/llvm/llvm-project/blob/llvmorg-11.0.1/llvm/include/llvm/IR/IRBuilder.h)
142-
- 该文件同样位于 debian:11[llvm-dev](https://packages.debian.org/bullseye/devel/llvm-dev) 包的 </usr/include/llvm/IR/IRBuilder.h>。
141+
- [llvm::IRBuilder](https://github.com/llvm/llvm-project/blob/llvmorg-14.0.6/llvm/include/llvm/IR/IRBuilder.h)
142+
- 该文件同样位于 debian:bookworm[llvm-dev](https://packages.debian.org/bookworm/devel/llvm-dev) 包的 </usr/include/llvm/IR/IRBuilder.h>。

lexer/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
find_package(FLEX REQUIRED)
2-
flex_target(lexer lexer.l main.cc DEFINES_FILE lexer.hh)
2+
flex_target(lexer lexer.l ${CMAKE_CURRENT_BINARY_DIR}/main.cc
3+
DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/lexer.hh)
34
add_executable(sysu-lexer ${FLEX_lexer_OUTPUTS})
45
install(TARGETS sysu-lexer)

lexer/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ eof '' Loc=<tester/functional/000_main.sysu.c:3:2>
7373
## 你可能会感兴趣的
7474

7575
- [Lexical Analysis With Flex](http://westes.github.io/flex/manual/)
76-
- [FindFLEX — CMake 3.18.6 Documentation](https://cmake.org/cmake/help/v3.18/module/FindFLEX.html)
77-
- [Preprocessor Output](https://gcc.gnu.org/onlinedocs/gcc-10.2.0/cpp/Preprocessor-Output.html)
76+
- [FindFLEX — CMake 3.13.5 Documentation](https://cmake.org/cmake/help/v3.13/module/FindFLEX.html)
77+
- [Preprocessor Output](https://gcc.gnu.org/onlinedocs/gcc-12.2.0/cpp/Preprocessor-Output.html)
7878
- [这篇博客](https://wu-kan.cn/2020/05/14/%E4%BD%BF%E7%94%A8%E8%AF%8D%E6%B3%95%E5%88%86%E6%9E%90%E5%99%A8-Flex-%E6%8F%90%E5%8F%96%E7%A8%8B%E5%BA%8F%E4%B8%AD%E7%9A%84%E6%95%B4%E6%95%B0%E5%92%8C%E6%B5%AE%E7%82%B9%E6%95%B0/)提到了一种处理注释的方案,如果你不想使用 [flex 自带的注释处理方法](http://westes.github.io/flex/manual/Comments-in-the-Input.html)(当然,实际上注释在预处理阶段已经去除了…)。
7979
- [这篇博客](https://wu-kan.cn/2020/07/03/%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F%E5%85%B3%E7%B3%BB%E5%88%A4%E5%AE%9A/)通过构造有限自动机,判断两个正则表达式的关系。

librarian/CMakeLists.txt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1 @@
1-
set(libs sysy;sysu)
2-
foreach(lib IN LISTS libs)
3-
file(GLOB mains ${lib}/*.cc)
4-
add_library(${lib} SHARED ${mains})
5-
install(TARGETS ${lib})
6-
file(GLOB mains ${lib}/*.h)
7-
foreach(mainfile ${mains})
8-
install(FILES ${mainfile} DESTINATION include/${lib})
9-
endforeach()
10-
endforeach()
1+
add_subdirectory(lib)
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)