Skip to content

Commit

Permalink
添加编译脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
lollipopkit committed Sep 30, 2022
1 parent fe704b0 commit 8ce7697
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 17 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: goreleaser

on:
push:

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
lk
releases
*/*.lkc
40 changes: 40 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This is an example .goreleaser.yml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod download
# you may remove this if you don't need go generate
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm
- arm64
goarm:
- 6
- 7
ignore:
- goos: windows
goarch: arm
goarm: 6
- goos: windows
goarch: arm
goarm: 7

checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
54 changes: 40 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
# Lang LK
改编自Lua5.3,[luago](https://github.com/zxh0/luago-book)
<h1 align="center">Lang LK</h1>

## 生态
<p align="center">
<img alt="badge-lang" src="https://badgen.net/badge/Lang/LK/cyan">
<img alt="badge-lang" src="https://badgen.net/badge/Lk/0.1.1/blue">
<img alt="badge-lang" src="https://badgen.net/badge/Go/1.19/purple">
</p>

## 🌳 生态
- Vscode插件:[高亮](https://git.lolli.tech/lollipopkit/vscode-lang-lk-highlight)

## 速览
**详细语法**,可以查看[test](test)文件夹的内容
## ⌨️ 体验
如果没有可执行文件,可以前往 [Release](https://github.com/LollipopKit/lang-lk/releases) 下载可执行文件。
`go build .`生成可执行文件。
#### REPL
`./lk`

#### 运行`.lk`
```bash
./lk <file>
# 如果修改了.lk文件导致无法运行,可以尝试添加-f参数
./lk -f <file>
```

## 📄 语法
**详细语法**,可以查看 [test](test) 文件夹的内容

```js
// 发送请求
Expand Down Expand Up @@ -51,19 +69,27 @@ if http.listen(':8080', handle) != nil {
}
```

## TODO
## 🔖 TODO
- 语法
- [x] 注释`//` `/* */`
- [x] 去除`repeat` `until` `goto`
- [x] Raw String, `\``
- [x] 支持任意对象 Concat
- Table
- [x] 注释`//` `/* */`
- [x] 去除 `repeat` `until` `goto`
- [x] Raw String, 使用``` ` ```包裹字符
- [x] 支持任意对象 Concat `..`
- [ ] Table
- [x] key为StringExp,而不是NameExp
- [x] `=` -> `:`, eg: `{a = 'a'}` -> `{a: 'a'}`
- [ ] 改变 `metatable` 设置方式
- [ ] 改变 `metatable` 设置方式
- 编译器
- [x] 自动添加`range` ( `paris` )
- [x] 支持`a++` `a+=b`
- CLI
- [x] 利用HASH,文件无变化不编译
- [x] 支持传入参数
- [x] REPL
- [x] 支持传入参数 (`lk args.lk arg1` -> `.lk`内调用`os.args`)
- [x] REPL,直接运行`./lk`即可进入

## 💌 致谢
- Lua
- [luago](https://github.com/zxh0/luago-book)

## 📝 License
`LollipopKit 2022 LGPL-3.0`
21 changes: 21 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os
import sys

args = sys.argv
if len(args) < 2:
print("Usage: python3 build.py <version>")
exit(1)
version = args[1]

arch = ['arm64', 'amd64']
platform = ['darwin', 'linux', 'windows']

for a in arch:
for p in platform:
suffix = '.exe' if p == 'windows' else ''
cmd = f'GOOS={p} GOARCH={a} go build -o releases/lk-{p}-{a}-v{version}{suffix}'
code = os.system(cmd)
if code != 0:
print(f'Failed to build {p}-{a}')
exit(code)
print(f'Successfully built {p}-{a}')
3 changes: 0 additions & 3 deletions stdlib/lib_os.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package stdlib

//#include <time.h>
import "C"

import (
"io/fs"
"os"
Expand Down

0 comments on commit 8ce7697

Please sign in to comment.