Skip to content

Commit

Permalink
Merge pull request #46 from flax-lang/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiayang authored Dec 1, 2020
2 parents f436968 + 6425002 commit cff849e
Show file tree
Hide file tree
Showing 189 changed files with 12,011 additions and 9,093 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: CI
on: [push, pull_request]

jobs:
build-linux:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: install dependencies
run: |
sudo echo "deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main" | sudo tee -a /etc/apt/sources.list
sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt -y update
sudo apt-get -o Dpkg::Options::="--force-overwrite" --allow-unauthenticated -y install -y g++-9 llvm-11 llvm-11-dev libllvm11 libmpfr-dev libmpfr6
- name: build
env:
LLVM_CONFIG: llvm-config-11
CC: gcc-9
CXX: g++-9
run: make -j2 build
- name: jit/llvm
run: build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape -run -backend llvm build/tester.flx
- name: jit/interp
run: build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape -run -backend interp build/tester.flx
- name: compile/llvm
run: build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape build/tester.flx && ./tester

build-macos:
runs-on: macOS-10.15
steps:
- uses: actions/checkout@v1
- name: install dependencies
run: |
brew install mpfr llvm pkg-config
- name: build
env:
LLVM_CONFIG: /usr/local/opt/llvm/bin/llvm-config
run: PATH="$PATH:$(pwd)/llvm/11.0.0/bin" make -j2 build
- name: jit/llvm
run: build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape -run -backend llvm build/tester.flx
- name: jit/interp
run: build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape -run -backend interp build/tester.flx
- name: compile/llvm
run: build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape build/tester.flx && ./tester

build-windows:
runs-on: windows-2019
env:
MPIR_ROOT_DIR: C:/tmp/lib/mpir
MPFR_ROOT_DIR: C:/tmp/lib/mpfr
LLVM_ROOT_DIR: C:/tmp/lib/llvm
LIBFFI_ROOT_DIR: C:/tmp/lib/libffi
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- uses: seanmiddleditch/gha-setup-ninja@v1
- uses: seanmiddleditch/gha-setup-vsdevenv@master
- uses: actions/checkout@v1
- name: cache libraries
uses: actions/[email protected]
id: cache-libs
with:
path: C:/tmp/lib
key: cached-libs
- name: download libraries
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
echo "root dirs:" $LLVM_ROOT_DIR
echo "extraction: C:\tmp\lib"
Invoke-WebRequest 'https://github.com/flax-lang/flax/releases/download/win-build-deps/libraries.zip' -OutFile 'libs.zip'
7z x -y -o"C:\tmp\lib" libs.zip
- name: install meson
run: pip install meson
- name: build
run: |
meson --buildtype=release build/meson-rel
ninja -C build/meson-rel
- name: copy stdlib
run: |
New-Item -Force -Path build\sysroot\usr\local\lib\flaxlibs -ItemType Directory
Copy-Item -Recurse -Force libs\* build\sysroot\usr\local\lib\flaxlibs\
- name: jit/llvm
run: build\meson-rel\flaxc.exe -sysroot build\sysroot -run -backend llvm --ffi-escape build\tester.flx
- name: jit/interp
run: build\meson-rel\flaxc.exe -sysroot build\sysroot -run -backend interp --ffi-escape build\tester.flx
- name: compile/llvm
run: |
build\meson-rel\flaxc.exe -sysroot build\sysroot --ffi-escape build\tester.flx
.\tester.exe
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# Makefile dependencies
*.cpp.d
*.c.d
*.h.d

# Compiled Dynamic libraries
*.so
Expand All @@ -32,6 +33,9 @@
*.app
*.pdb

# profile data
*.profdata
*.profraw


# overrides:
Expand All @@ -42,9 +46,6 @@ build/sysroot
build/meson-*
.modifydates

# this is a generated file, so we ignore it.
source/unity.cpp

build/test
build/gltest
build/standalone
Expand All @@ -71,13 +72,15 @@ bug-repro
*.vcxproj.user

countloc.bat
builddir

prof.svg
prof_with_square.svg
build/cmake-output
.idea
# CMakeLists.txt

.flax-repl-history

docs/.antlr

Expand All @@ -99,4 +102,5 @@ flax.includes
build/__pycache__
*.vspx

.cache
compile_flags.txt
15 changes: 7 additions & 8 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ blocks:
- name: build
commands:
- checkout
- sudo echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main" | sudo tee -a /etc/apt/sources.list
- sudo echo "deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main" | sudo tee -a /etc/apt/sources.list
- sudo wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
- sudo echo "deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main" | sudo tee -a /etc/apt/sources.list
- sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
- sudo apt -y update
- sudo apt-get -o Dpkg::Options::="--force-overwrite" --allow-unauthenticated -y install -y llvm-7 llvm-7-dev libllvm7 libmpfr-dev libmpfr6
- CXX=g++-8 CC=gcc-8 LLVM_CONFIG=llvm-config-7 make -j2 build
- build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile -run -backend llvm build/tester.flx
- build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile -run -backend interp build/tester.flx
- build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile build/tester.flx && ./tester
- sudo apt-get -o Dpkg::Options::="--force-overwrite" --allow-unauthenticated -y install -y llvm-11 llvm-11-dev libllvm11 libmpfr-dev libmpfr6
- CXX=g++-8 CC=gcc-8 LLVM_CONFIG=llvm-config-11 make -j2 build
- build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape -run -backend llvm build/tester.flx
- build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape -run -backend interp build/tester.flx
- build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape build/tester.flx && ./tester
58 changes: 0 additions & 58 deletions .travis.yml

This file was deleted.

25 changes: 15 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ A low level, general-purpose language with high level syntax and expressibility.
[![forthebadge](https://forthebadge.com/images/badges/made-with-crayons.svg)](http://forthebadge.com)
[![forthebadge](https://forthebadge.com/images/badges/built-with-resentment.svg)](http://forthebadge.com)

[![Build Status](https://semaphoreci.com/api/v1/zhiayang/flax/branches/develop/badge.svg)](https://semaphoreci.com/zhiayang/flax)
    
[![Build status](https://ci.appveyor.com/api/projects/status/c9cmm08t27ef1hji/branch/develop?svg=true)](https://ci.appveyor.com/project/zhiayang/flax/branch/develop)
[![build status](https://ci.appveyor.com/api/projects/status/c9cmm08t27ef1hji/branch/develop?svg=true)](https://ci.appveyor.com/project/zhiayang/flax/branch/develop)
    
[![Build Status](https://travis-ci.org/flax-lang/flax.svg?branch=develop)](https://travis-ci.org/flax-lang/flax)
[![build status](https://github.com/flax-lang/flax/workflows/CI/badge.svg)](https://github.com/flax-lang/flax/actions)
    
[![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)

[![Build Status](https://semaphoreci.com/api/v1/zhiayang/flax/branches/develop/badge.svg)](https://semaphoreci.com/zhiayang/flax)


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

Development is currently on hiatus. Regular work will resume NET 2019-12-09.

### Language Goals

- No header files.
Expand Down Expand Up @@ -113,7 +108,7 @@ do {
### Building the Flax compiler

#### Dependencies ####
- LLVM 7, mostly due to their obsession with changing the IR interface every damn version
- LLVM 11, mostly due to their obsession with changing the IR interface every damn version
- GMP/MPIR
- MPFR
- libffi
Expand All @@ -122,7 +117,7 @@ do {
#### macOS / Linux

- The `makefile` is the preferred way to build on UNIX systems.
- 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.
- 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.
- A C++17-compatible compiler should be used.
- Find the `flaxc` executable in `build/sysroot/usr/local/bin`.
- Additionally, the (admittedly limited) standard library will be copied from `./libs` to `./build/sysroot/usr/local/lib/flaxlibs/`.
Expand Down Expand Up @@ -170,6 +165,16 @@ welcome.



### Licensing

The Flax compiler itself (this repository) is licensed under the Apache 2.0 license (see `LICENSE` file). For ease of building, some dependencies
are included in the repository itself (under the `external` folder) and compiled together, instead of as a separate library (shared or otherwise).
These are:

1. [mpreal](https://bitbucket.org/advanpix/mpreal), GPL
2. [utf8rewind](https://bitbucket.org/knight666/utf8rewind), MIT
3. [tinyprocesslib](https://gitlab.com/eidheim/tiny-process-library), MIT




Expand Down
9 changes: 6 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ environment:
LLVM_ROOT_DIR: c:\projects\lib\llvm
LIBFFI_ROOT_DIR: c:\projects\lib\libffi


cache:
- c:\projects\lib -> appveyor.yml


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


build_script:
- ps: meson --buildtype=release build/meson-rel
- ps: ninja -C build/meson-rel
Expand All @@ -39,9 +42,9 @@ test_script:
- ps: cd c:\projects\flax
- ps: New-Item -Force -Path build\sysroot\usr\local\lib\flaxlibs -ItemType Directory
- ps: Copy-Item -Recurse -Force libs\* build\sysroot\usr\local\lib\flaxlibs\
- ps: build\meson-rel\flaxc.exe -sysroot build\sysroot -run -backend llvm build\tester.flx
- ps: build\meson-rel\flaxc.exe -sysroot build\sysroot -run -backend interp build\tester.flx
- ps: build\meson-rel\flaxc.exe -sysroot build\sysroot build\tester.flx
- ps: build\meson-rel\flaxc.exe -sysroot build\sysroot --ffi-escape -run -backend llvm build\tester.flx
- ps: build\meson-rel\flaxc.exe -sysroot build\sysroot --ffi-escape -run -backend interp build\tester.flx
- ps: build\meson-rel\flaxc.exe -sysroot build\sysroot --ffi-escape build\tester.flx
- ps: .\tester.exe

after_test:
Expand Down
17 changes: 17 additions & 0 deletions build/a.flx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// a.flx
// Copyright (c) 2020, zhiayang
// Licensed under the Apache License Version 2.0.

// import libc as _
export a
import libc

import std::io as _

// import b
// import d

@entry fn main()
{
print("uwu\n")
}
7 changes: 7 additions & 0 deletions build/b.flx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// b.flx
// Copyright (c) 2020, zhiayang
// Licensed under the Apache License Version 2.0.

export a
import libc

30 changes: 30 additions & 0 deletions build/c.flx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// ultratiny.flx
// Copyright (c) 2019, zhiayang
// Licensed under the Apache License Version 2.0.

export ultratiny

// import libc as _
import a

@entry fn main()
{
// printf("q = %d\n", 37)
}

















6 changes: 6 additions & 0 deletions build/d.flx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// d.flx
// Copyright (c) 2020, zhiayang
// Licensed under the Apache License Version 2.0.

export a
import libc
Loading

0 comments on commit cff849e

Please sign in to comment.