Skip to content

Commit cff849e

Browse files
authored
Merge pull request #46 from flax-lang/develop
2 parents f436968 + 6425002 commit cff849e

File tree

189 files changed

+12011
-9093
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+12011
-9093
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: CI
2+
on: [push, pull_request]
3+
4+
jobs:
5+
build-linux:
6+
runs-on: ubuntu-18.04
7+
steps:
8+
- uses: actions/checkout@v1
9+
- name: install dependencies
10+
run: |
11+
sudo echo "deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main" | sudo tee -a /etc/apt/sources.list
12+
sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
13+
sudo apt -y update
14+
sudo apt-get -o Dpkg::Options::="--force-overwrite" --allow-unauthenticated -y install -y g++-9 llvm-11 llvm-11-dev libllvm11 libmpfr-dev libmpfr6
15+
- name: build
16+
env:
17+
LLVM_CONFIG: llvm-config-11
18+
CC: gcc-9
19+
CXX: g++-9
20+
run: make -j2 build
21+
- name: jit/llvm
22+
run: build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape -run -backend llvm build/tester.flx
23+
- name: jit/interp
24+
run: build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape -run -backend interp build/tester.flx
25+
- name: compile/llvm
26+
run: build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape build/tester.flx && ./tester
27+
28+
build-macos:
29+
runs-on: macOS-10.15
30+
steps:
31+
- uses: actions/checkout@v1
32+
- name: install dependencies
33+
run: |
34+
brew install mpfr llvm pkg-config
35+
- name: build
36+
env:
37+
LLVM_CONFIG: /usr/local/opt/llvm/bin/llvm-config
38+
run: PATH="$PATH:$(pwd)/llvm/11.0.0/bin" make -j2 build
39+
- name: jit/llvm
40+
run: build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape -run -backend llvm build/tester.flx
41+
- name: jit/interp
42+
run: build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape -run -backend interp build/tester.flx
43+
- name: compile/llvm
44+
run: build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape build/tester.flx && ./tester
45+
46+
build-windows:
47+
runs-on: windows-2019
48+
env:
49+
MPIR_ROOT_DIR: C:/tmp/lib/mpir
50+
MPFR_ROOT_DIR: C:/tmp/lib/mpfr
51+
LLVM_ROOT_DIR: C:/tmp/lib/llvm
52+
LIBFFI_ROOT_DIR: C:/tmp/lib/libffi
53+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
54+
steps:
55+
- uses: seanmiddleditch/gha-setup-ninja@v1
56+
- uses: seanmiddleditch/gha-setup-vsdevenv@master
57+
- uses: actions/checkout@v1
58+
- name: cache libraries
59+
uses: actions/[email protected]
60+
id: cache-libs
61+
with:
62+
path: C:/tmp/lib
63+
key: cached-libs
64+
- name: download libraries
65+
if: steps.cache-libs.outputs.cache-hit != 'true'
66+
run: |
67+
echo "root dirs:" $LLVM_ROOT_DIR
68+
echo "extraction: C:\tmp\lib"
69+
Invoke-WebRequest 'https://github.com/flax-lang/flax/releases/download/win-build-deps/libraries.zip' -OutFile 'libs.zip'
70+
7z x -y -o"C:\tmp\lib" libs.zip
71+
- name: install meson
72+
run: pip install meson
73+
- name: build
74+
run: |
75+
meson --buildtype=release build/meson-rel
76+
ninja -C build/meson-rel
77+
- name: copy stdlib
78+
run: |
79+
New-Item -Force -Path build\sysroot\usr\local\lib\flaxlibs -ItemType Directory
80+
Copy-Item -Recurse -Force libs\* build\sysroot\usr\local\lib\flaxlibs\
81+
- name: jit/llvm
82+
run: build\meson-rel\flaxc.exe -sysroot build\sysroot -run -backend llvm --ffi-escape build\tester.flx
83+
- name: jit/interp
84+
run: build\meson-rel\flaxc.exe -sysroot build\sysroot -run -backend interp --ffi-escape build\tester.flx
85+
- name: compile/llvm
86+
run: |
87+
build\meson-rel\flaxc.exe -sysroot build\sysroot --ffi-escape build\tester.flx
88+
.\tester.exe
89+
90+
91+
92+
93+
94+

.gitignore

+7-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# Makefile dependencies
1212
*.cpp.d
1313
*.c.d
14+
*.h.d
1415

1516
# Compiled Dynamic libraries
1617
*.so
@@ -32,6 +33,9 @@
3233
*.app
3334
*.pdb
3435

36+
# profile data
37+
*.profdata
38+
*.profraw
3539

3640

3741
# overrides:
@@ -42,9 +46,6 @@ build/sysroot
4246
build/meson-*
4347
.modifydates
4448

45-
# this is a generated file, so we ignore it.
46-
source/unity.cpp
47-
4849
build/test
4950
build/gltest
5051
build/standalone
@@ -71,13 +72,15 @@ bug-repro
7172
*.vcxproj.user
7273

7374
countloc.bat
75+
builddir
7476

7577
prof.svg
7678
prof_with_square.svg
7779
build/cmake-output
7880
.idea
7981
# CMakeLists.txt
8082

83+
.flax-repl-history
8184

8285
docs/.antlr
8386

@@ -99,4 +102,5 @@ flax.includes
99102
build/__pycache__
100103
*.vspx
101104

105+
.cache
102106
compile_flags.txt

.semaphore/semaphore.yml

+7-8
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ blocks:
1515
- name: build
1616
commands:
1717
- checkout
18-
- sudo echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main" | sudo tee -a /etc/apt/sources.list
19-
- sudo echo "deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main" | sudo tee -a /etc/apt/sources.list
20-
- sudo wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
18+
- sudo echo "deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main" | sudo tee -a /etc/apt/sources.list
19+
- sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
2120
- sudo apt -y update
22-
- sudo apt-get -o Dpkg::Options::="--force-overwrite" --allow-unauthenticated -y install -y llvm-7 llvm-7-dev libllvm7 libmpfr-dev libmpfr6
23-
- CXX=g++-8 CC=gcc-8 LLVM_CONFIG=llvm-config-7 make -j2 build
24-
- build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile -run -backend llvm build/tester.flx
25-
- build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile -run -backend interp build/tester.flx
26-
- build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile build/tester.flx && ./tester
21+
- sudo apt-get -o Dpkg::Options::="--force-overwrite" --allow-unauthenticated -y install -y llvm-11 llvm-11-dev libllvm11 libmpfr-dev libmpfr6
22+
- CXX=g++-8 CC=gcc-8 LLVM_CONFIG=llvm-config-11 make -j2 build
23+
- build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape -run -backend llvm build/tester.flx
24+
- build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape -run -backend interp build/tester.flx
25+
- build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape build/tester.flx && ./tester

.travis.yml

-58
This file was deleted.

README.md

+15-10
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@ A low level, general-purpose language with high level syntax and expressibility.
66
[![forthebadge](https://forthebadge.com/images/badges/made-with-crayons.svg)](http://forthebadge.com)
77
[![forthebadge](https://forthebadge.com/images/badges/built-with-resentment.svg)](http://forthebadge.com)
88

9-
[![Build Status](https://semaphoreci.com/api/v1/zhiayang/flax/branches/develop/badge.svg)](https://semaphoreci.com/zhiayang/flax)
10-
    
11-
[![Build status](https://ci.appveyor.com/api/projects/status/c9cmm08t27ef1hji/branch/develop?svg=true)](https://ci.appveyor.com/project/zhiayang/flax/branch/develop)
9+
[![build status](https://ci.appveyor.com/api/projects/status/c9cmm08t27ef1hji/branch/develop?svg=true)](https://ci.appveyor.com/project/zhiayang/flax/branch/develop)
1210
    
13-
[![Build Status](https://travis-ci.org/flax-lang/flax.svg?branch=develop)](https://travis-ci.org/flax-lang/flax)
11+
[![build status](https://github.com/flax-lang/flax/workflows/CI/badge.svg)](https://github.com/flax-lang/flax/actions)
1412
    
15-
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/flax-lang/flax.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/flax-lang/flax/context:cpp)
16-
13+
[![Build Status](https://semaphoreci.com/api/v1/zhiayang/flax/branches/develop/badge.svg)](https://semaphoreci.com/zhiayang/flax)
1714

1815

1916
-----------------------------------------------
@@ -29,8 +26,6 @@ A low level, general-purpose language with high level syntax and expressibility.
2926
I work on Flax in my spare time, and as the lone developer I cannot guarantee continuous development.
3027
I'm no famous artist but this is my magnum opus, so it'll not be abandoned anytime soon.
3128

32-
Development is currently on hiatus. Regular work will resume NET 2019-12-09.
33-
3429
### Language Goals
3530

3631
- No header files.
@@ -113,7 +108,7 @@ do {
113108
### Building the Flax compiler
114109

115110
#### Dependencies ####
116-
- LLVM 7, mostly due to their obsession with changing the IR interface every damn version
111+
- LLVM 11, mostly due to their obsession with changing the IR interface every damn version
117112
- GMP/MPIR
118113
- MPFR
119114
- libffi
@@ -122,7 +117,7 @@ do {
122117
#### macOS / Linux
123118

124119
- The `makefile` is the preferred way to build on UNIX systems.
125-
- LLVM needs to be installed. On macOS, `brew install llvm@7` should work, and you might need to do some PPA fiddling for Debian-based distros.
120+
- LLVM needs to be installed. On macOS, `brew install llvm` should work, and you might need to do some PPA fiddling for Debian-based distros.
126121
- A C++17-compatible compiler should be used.
127122
- Find the `flaxc` executable in `build/sysroot/usr/local/bin`.
128123
- Additionally, the (admittedly limited) standard library will be copied from `./libs` to `./build/sysroot/usr/local/lib/flaxlibs/`.
@@ -170,6 +165,16 @@ welcome.
170165

171166

172167

168+
### Licensing
169+
170+
The Flax compiler itself (this repository) is licensed under the Apache 2.0 license (see `LICENSE` file). For ease of building, some dependencies
171+
are included in the repository itself (under the `external` folder) and compiled together, instead of as a separate library (shared or otherwise).
172+
These are:
173+
174+
1. [mpreal](https://bitbucket.org/advanpix/mpreal), GPL
175+
2. [utf8rewind](https://bitbucket.org/knight666/utf8rewind), MIT
176+
3. [tinyprocesslib](https://gitlab.com/eidheim/tiny-process-library), MIT
177+
173178

174179

175180

appveyor.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ environment:
99
LLVM_ROOT_DIR: c:\projects\lib\llvm
1010
LIBFFI_ROOT_DIR: c:\projects\lib\libffi
1111

12+
1213
cache:
1314
- c:\projects\lib -> appveyor.yml
1415

16+
1517
install:
1618
# Set up the build environment
1719
- cmd: call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
@@ -31,6 +33,7 @@ install:
3133
# Install meson
3234
- cmd: pip install meson
3335

36+
3437
build_script:
3538
- ps: meson --buildtype=release build/meson-rel
3639
- ps: ninja -C build/meson-rel
@@ -39,9 +42,9 @@ test_script:
3942
- ps: cd c:\projects\flax
4043
- ps: New-Item -Force -Path build\sysroot\usr\local\lib\flaxlibs -ItemType Directory
4144
- ps: Copy-Item -Recurse -Force libs\* build\sysroot\usr\local\lib\flaxlibs\
42-
- ps: build\meson-rel\flaxc.exe -sysroot build\sysroot -run -backend llvm build\tester.flx
43-
- ps: build\meson-rel\flaxc.exe -sysroot build\sysroot -run -backend interp build\tester.flx
44-
- ps: build\meson-rel\flaxc.exe -sysroot build\sysroot build\tester.flx
45+
- ps: build\meson-rel\flaxc.exe -sysroot build\sysroot --ffi-escape -run -backend llvm build\tester.flx
46+
- ps: build\meson-rel\flaxc.exe -sysroot build\sysroot --ffi-escape -run -backend interp build\tester.flx
47+
- ps: build\meson-rel\flaxc.exe -sysroot build\sysroot --ffi-escape build\tester.flx
4548
- ps: .\tester.exe
4649

4750
after_test:

build/a.flx

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// a.flx
2+
// Copyright (c) 2020, zhiayang
3+
// Licensed under the Apache License Version 2.0.
4+
5+
// import libc as _
6+
export a
7+
import libc
8+
9+
import std::io as _
10+
11+
// import b
12+
// import d
13+
14+
@entry fn main()
15+
{
16+
print("uwu\n")
17+
}

build/b.flx

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// b.flx
2+
// Copyright (c) 2020, zhiayang
3+
// Licensed under the Apache License Version 2.0.
4+
5+
export a
6+
import libc
7+

build/c.flx

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// ultratiny.flx
2+
// Copyright (c) 2019, zhiayang
3+
// Licensed under the Apache License Version 2.0.
4+
5+
export ultratiny
6+
7+
// import libc as _
8+
import a
9+
10+
@entry fn main()
11+
{
12+
// printf("q = %d\n", 37)
13+
}
14+
15+
16+
17+
18+
19+
20+
21+
22+
23+
24+
25+
26+
27+
28+
29+
30+

build/d.flx

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// d.flx
2+
// Copyright (c) 2020, zhiayang
3+
// Licensed under the Apache License Version 2.0.
4+
5+
export a
6+
import libc

0 commit comments

Comments
 (0)