Skip to content

Commit

Permalink
Merge pull request #91 from yuyan-lang/continue_to_compilation
Browse files Browse the repository at this point in the history
新的运行时环境
  • Loading branch information
UltimatePea committed Feb 6, 2024
2 parents ab460c1 + cd3b287 commit 6f16126
Show file tree
Hide file tree
Showing 93 changed files with 1,446 additions and 1,663 deletions.
19 changes: 19 additions & 0 deletions .github/actions/install-linux-dependencies@v2/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# .github/actions/install-mac-dependencies/action.yml

name: 'Install Linux Software'
description: 'Installs Linux Yuyan Dependencies'
runs:
using: 'composite'
steps:
- name: Install the libraries
run: |
sudo apt install make llvm clang libgmp-dev
sudo apt install libgc-dev libuv1-dev llvm libbsd-dev
shell: bash
- name: Download yy_bs from
run: |
curl -o yy_bs -L https://github.com/yuyan-lang/yuyan/releases/download/v0.1.0rc1.4/yy_bs_bs
curl -o ./运行时支持库/libyyrtoptv0.1.0rc2+0016.so -L https://github.com/yuyan-lang/yuyan/releases/download/v0.1.0rc1.4/libyyrtoptv0.1.0rc2+0016.so
curl -o ./运行时支持库/libyyrtdebugv0.1.0rc2+0016.so -L https://github.com/yuyan-lang/yuyan/releases/download/v0.1.0rc1.4/libyyrtdebugv0.1.0rc2+0016.so
chmod u+x yy_bs
shell: bash
13 changes: 3 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-linux-dependencies
- name: curl yy_bs
run: |
curl -o yy_bs -L https://github.com/yuyan-lang/yuyan/releases/download/v0.1.0beta5.2/yy_bs_bs
make -C ./运行时支持库/ all
chmod u+x yy_bs
- uses: ./.github/actions/install-linux-dependencies@v2
- name: make yy_bs_bs
run: ./yy_bs 豫言编译器/入口。豫 -o yy_bs_bs -c
- name: make yy_bs_bs_debug
Expand All @@ -152,10 +147,8 @@ jobs:
./yy_bs_bs_debug
./.yybuild.nosync/yy_入口_豫言编译器默认执行包.opt.bc
./.yybuild.nosync/yy_入口_豫言编译器默认执行包.bc
./运行时支持库/libyyrtdebug.a
./运行时支持库/libyyrtdebug.so
./运行时支持库/libyyrtopt.a
./运行时支持库/libyyrtopt.so
./运行时支持库/*.a
./运行时支持库/*.so
ubuntu-bs-bs-build-p:
needs: ubuntu-bs-build-from-bs
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,5 @@ dist
*.bc
*.dylib
callgrind.out.*
cachegrind.out.*
cachegrind.out.*
.yybuild.*
74 changes: 0 additions & 74 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,80 +4,6 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "yy_runtest",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/yy_runtest",
"args": [
"yy"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb"
},
{
"name": "yy_bs_bs",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/yy_bs_bs",
"args": [
"yylib/标准库/语言核心/内建类型。豫"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"setupCommands": [
{
"text": "handle SIGSEGV nostop"
}
]
// "MIMode": "lldb",
// "MIDebuggerPath": "/usr/bin/lldb"
},
{
"name": "./yy_hello_world_11",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/yy_hello_world_11",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": false,
"setupCommands": [
{
"text": "handle SIGSEGV noprint nostop pass",
"description": "ingore libgc related errors",
"ignoreFailures": false
}
]
// "MIMode": "lldb",
// "miDebuggerPath": "/usr/bin/lldb"
},
{
"name": "./yy_hello_world_12",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/yy_hello_world_12",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": false,
"setupCommands": [
{
"text": "handle SIGSEGV noprint nostop pass",
"description": "ingore libgc related errors",
"ignoreFailures": false
}
]
// "MIMode": "lldb",
// "miDebuggerPath": "/usr/bin/lldb"
},
{
"name": "./yy_exec_debug",
"type": "cppdbg",
Expand Down
46 changes: 35 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ YYTESTSOURCES := $(shell find . -name '*。测试。豫' ! -path "*/.cm/*")
build: yy yyrt

yyrt:
# make -C runtime/ opt
make -C runtime/ debug

yy_runtime_lib:
make -C ./运行时支持库 all VERSION=$(shell sed -n -E 's/^.*v(.*)\+([0-9]{4}).*/v\1+\2/p' 豫言编译器/编译辅助工具/命令行/版本管理。豫)

yy: $(SMLSOURCES)
mlton -output yy -verbose 2 src/development.mlb

Expand All @@ -26,19 +28,34 @@ yy_bs_bs_parallel : $(YYBSSOURCES) $(YYLIBSOURCES)
./yy_bs 豫言编译器/入口。豫 -o yy_bs_bs --parallel -c --debug

yy_bs_bs_bs: $(YYBSSOURCES) $(YYLIBSOURCES)
make cleancache
./yy_bs_bs 豫言编译器/入口。豫 -o yy_bs_bs_bs -c --parallel --debug
./yy_bs_bs 豫言编译器/入口。豫 -o yy_bs_bs_bs -c --parallel --debug $(OPTIONS)

yy_bs_bs_bs_bs: $(YYBSSOURCES) $(YYLIBSOURCES)
./yy_bs_bs_bs 豫言编译器/入口。豫 -o yy_bs_bs_bs_bs -c --parallel --debug --static-linking $(OPTIONS) --optimize

yy_bs_bs_bs_bs_bs: $(YYBSSOURCES) $(YYLIBSOURCES)
./yy_bs_bs_bs_bs 豫言编译器/入口。豫 -o yy_bs_bs_bs_bs_bs -c --parallel --debug --static-linking $(OPTIONS) --optimize

yy_bs3 : yy_bs_bs_bs

yy_bs4 : yy_bs_bs_bs_bs

yy_bs_bs_bs_bs: $(YYBSSOURCES) $(YYLIBSOURCES) yy_bs_bs_bs
make cleancache
./yy_bs_bs_bs 豫言编译器/入口。豫 -o yy_bs_bs_bs_bs -c --parallel --debug --static-linking
yy_bs5 : yy_bs_bs_bs_bs_bs

yy_bs_bs_bs_bs_debug: $(YYBSSOURCES) $(YYLIBSOURCES) yy_bs_bs_bs
make cleancache
./yy_bs_bs_bs 豫言编译器/入口。豫 -o yy_bs_bs_bs_bs_debug -c --parallel --debug --do-not-optimize
./yy_bs_bs_bs 豫言编译器/入口。豫 -o yy_bs_bs_bs_bs_debug -c --parallel --debug --do-not-optimize $(OPTIONS)

yy_bs_bs_bs_bs_quick: $(YYBSSOURCES) $(YYLIBSOURCES) yy_bs_bs_bs
./yy_bs_bs_bs 豫言编译器/入口。豫 -o yy_bs_bs_bs_bs_opt -c --parallel --debug

restore_bs_bs:
mv yy_bs_bs yy_bs_bs_old
cp yy_bs_bs_rc1 yy_bs_bs


update_bs_bs:
mv yy_bs_bs yy_bs_bs_old
sh increment_build_number.sh
cp yy_bs_bs_bs_bs yy_bs_bs

.PHONY: yy_bs_bs_debug
Expand Down Expand Up @@ -187,8 +204,9 @@ createcache:
mount -t tmpfs none .yybuild.nosync

cleancache:
find .yybuild.nosync/ -type f -delete
find .yybuild.nosync/ -mindepth 1 -type d -delete
rm -rf .yybuild*
# find .yybuild.nosync/ -type f -delete
# find .yybuild.nosync/ -mindepth 1 -type d -delete
rm -f yy_parallel_log.txt

CACHE_DIR := ./.yybuild.nosync
Expand All @@ -210,4 +228,10 @@ restorecache:
unzip -q yy_cache_data.zip -d yy_restore_temp
cp -n -r yy_restore_temp/* $(CACHE_DIR)
rm -rf yy_restore_temp
echo "Cache restored."
echo "Cache restored."

# VERSION = $(error Please set VERSION=... as a command line argument for uploading to GitHub release.)
RUNTIME_LIB_FILES := $(shell find ./运行时支持库 \( -name '*$(VERSION)*' \) )
upload_gh_release:
echo $(VERSION)
gh release upload $(VERSION) yy_bs_bs $(RUNTIME_LIB_FILES)
16 changes: 7 additions & 9 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

专为中文编程设计的高级函数式通用编程语言

本软件仍在早期测试中,仅供测评使用。

[网站](https://yuyan-lang.github.io/yuyan)
[语言手册](教程/combined_tutorial.pdf)

Expand All @@ -21,16 +23,14 @@

## 安装

若要快速编译最新版,请参见[`快速编译`](快速编译.md)

如果想二次开发并从源代码文件编译,请参见[`从源代码编译`](从源代码编译.md)
请参见[`从源代码编译`](从源代码编译.md)

## 语言规范

<!-- [语言规范](LanguageSpecification.md) -->
[教程](教程/00-教程目录.md)
[教程](教程/0000-教程目录.md)

[语法表](语法表.md)
[语法表](教程/0100-语法对照表.md)


## 运行
Expand All @@ -49,12 +49,10 @@

## 提交反馈

如您有任何意见或者建议,欢迎提Issue或通过Slack,邮件,企业微信与我们取得联系
如您有任何意见或者建议,欢迎提Issue或PLOC论坛或者微信群与我们取得联系

## 联系我们

Slack: https://join.slack.com/t/w1668741933-poz509122/shared_invite/zt-1k1hk30n7-FQNwZ0tefBePMxPSFrcbGg

微信群:[群二维码](community_qr_wecom.png)

邮箱: yuyanlang@icloud.com
<!-- 邮箱: yuyanlang@icloud.com -->
52 changes: 29 additions & 23 deletions docs/从源代码编译.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,47 @@

# 从源代码编译
# 编译豫言编译器

## Mac
(目前仅支持`Ubuntu/Linux`,Mac的支持会在后续版本中添加)

1. 克隆本仓库
2. 安装依赖库
1. 安装标准构建工具依赖
```
brew install bdw-gc libuv mlton matplotplusplus llvm
sudo apt install make clang llvm python3-dev libuv1-dev
```
3. 安装

2.`Releases`界面下载可运行程序,目前可以运行在`22.04 LTS`版本的系统上

可执行文件为:
```
make
make install
chmod u+x yy_bs_bs
```

依赖库文件`libyyrt<debug/opt>+XXXX.a`或者`libyyrt<debug/opt>+XXXX.so`需要放在`./运行时支持库`

若要使用标准库,可以将源码文件中的`./yylib`文件夹拷贝到当前工作目录下。

在当前工作目录下创建一个豫言文件,拓展名为`.yuyan``。豫`

## Linux (Ubuntu)
3. 编写并运行文件

1. 克隆本仓库
2. 安装依赖库

可以使用一下命令编译
```
sudo apt install libgc-dev libuv1-dev libbsd-dev llvm
./yy_bs_bs <文件名> -c -o a.out
```
3. 安装MLton
http://mlton.org

4. 安装其他依赖(现阶段安装无法运行,之后会改)
+ MatPlot++
https://alandefreitas.github.io/matplotplusplus/

5. 安装
然后编译文件可以运行
```
make
make install
./a.out
```

## Windows
一些常用的命令行参数
+ `-o <path>` 生成可执行文件路径
+ `-c` 仅编译而不执行
+ `--parallel` 使用并行编译,需要拷贝`parallel_compile.py`到项目根目录下
+ `--static-linking` 使用静态链接
+ `--optimize`使用LLVM的全局优化和链接时优化

4. 关于语法高亮

请暂时用Cygwin或者Windows Subsystem for Linux运行
目前`yy_bs_bs`还不支持VSCode插件的语法高亮,需要从SML源代码编译出`./yy`的可执行文件才行。需要安装`mlton`http://mlton.org)之后`make yy`来编译文件

Loading

0 comments on commit 6f16126

Please sign in to comment.