Skip to content

Commit

Permalink
Merge pull request #44 from flax-lang/scope-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiayang authored Dec 1, 2020
2 parents a39c3df + 5e50c83 commit 12de5ae
Show file tree
Hide file tree
Showing 122 changed files with 2,897 additions and 2,078 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ jobs:
- uses: actions/checkout@v1
- name: install dependencies
run: |
sudo echo "deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main" | sudo tee -a /etc/apt/sources.list
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-9 llvm-9-dev libllvm9 libmpfr-dev libmpfr6
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-9
LLVM_CONFIG: llvm-config-11
CC: gcc-9
CXX: g++-9
run: make -j2 build
Expand All @@ -24,9 +24,9 @@ jobs:
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.14
runs-on: macOS-10.15
steps:
- uses: actions/checkout@v1
- name: install dependencies
Expand All @@ -35,21 +35,22 @@ jobs:
- name: build
env:
LLVM_CONFIG: /usr/local/opt/llvm/bin/llvm-config
run: PATH="$PATH:$(pwd)/llvm/9.0.0/bin" make -j2 build
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
Expand Down Expand Up @@ -85,7 +86,7 @@ jobs:
run: |
build\meson-rel\flaxc.exe -sysroot build\sysroot --ffi-escape build\tester.flx
.\tester.exe
Expand Down
3 changes: 3 additions & 0 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 Down Expand Up @@ -71,6 +72,7 @@ bug-repro
*.vcxproj.user

countloc.bat
builddir

prof.svg
prof_with_square.svg
Expand Down Expand Up @@ -100,4 +102,5 @@ flax.includes
build/__pycache__
*.vspx

.cache
compile_flags.txt
6 changes: 3 additions & 3 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ blocks:
- name: build
commands:
- checkout
- sudo echo "deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main" | sudo tee -a /etc/apt/sources.list
- 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-9 llvm-9-dev libllvm9 libmpfr-dev libmpfr6
- CXX=g++-8 CC=gcc-8 LLVM_CONFIG=llvm-config-9 make -j2 build
- 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
71 changes: 0 additions & 71 deletions .travis.yml

This file was deleted.

13 changes: 1 addition & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,10 @@ 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://travis-ci.org/flax-lang/flax.svg?branch=develop)](https://travis-ci.org/flax-lang/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://github.com/flax-lang/flax/workflows/CI/badge.svg)](https://github.com/flax-lang/flax/actions)
    
[![codecov](https://codecov.io/gh/flax-lang/flax/branch/develop/graph/badge.svg)](https://codecov.io/gh/flax-lang/flax)
    
[![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)

Currently not expected to pass (for a while): <br />
[![Build Status](https://semaphoreci.com/api/v1/zhiayang/flax/branches/develop/badge.svg)](https://semaphoreci.com/zhiayang/flax)


Expand All @@ -33,8 +26,6 @@ Currently not expected to pass (for a while): <br />
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 @@ -116,10 +107,8 @@ do {

### Building the Flax compiler

Note: the `master` branch is still using LLVM 7, and is stable; `develop` is now on LLVM 9. Changes will be merged into `master` eventually.

#### Dependencies ####
- LLVM 9, 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 Down
2 changes: 2 additions & 0 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 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
1 change: 1 addition & 0 deletions build/supertiny.flx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

export supertiny

import std::io
import libc as _

// import std::io
Expand Down
2 changes: 1 addition & 1 deletion build/tests/intlimits.flx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public fn printIntegerLimits()

libc::printf("\n")

libc::printf(" u8::min = %hhu\t\t\t\t u8::max = %hhu\n", std::limits::uint8::min,std::limits:: uint8::max);
libc::printf(" u8::min = %hhu\t\t\t\t u8::max = %hhu\n", std::limits::uint8::min, std::limits::uint8::max);
libc::printf("u16::min = %hu\t\t\t\tu16::max = %hu\n", std::limits::uint16::min, std::limits::uint16::max);
libc::printf("u32::min = %u\t\t\t\tu32::max = %u\n", std::limits::uint32::min, std::limits::uint32::max);
libc::printf("u64::min = %llu\t\t\t\tu64::max = %llu\n", std::limits::uint64::min, std::limits::uint64::max);
Expand Down
24 changes: 24 additions & 0 deletions build/tiniest.flx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// tiniest.flx
// Copyright (c) 2020, zhiayang
// Licensed under the Apache License Version 2.0.

import libc

class wrapper<T>
{
init()
{
}

static fn method<U>(a: T, b: U)
{
libc::printf("t = %d, u = %d\n", typeid(a), typeid(b));
}
}


@entry fn main()
{
wrapper::method(1, "asdf")
libc::printf("hello, world\n")
}
54 changes: 52 additions & 2 deletions build/tmp/repro_1.flx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,61 @@
// Copyright (c) 2019, zhiayang
// Licensed under the Apache License Version 2.0.

/*
import libc as _
import repro_2 as _
// import repro_2 as _
import repro_2
import std::limits as lim

using repro_2 as _

@entry fn main()
{
// printf("four = %d\n", repro_2::Foo::FOUR.value);
class Foozle
{
init() { }

static fn alpha() { }

class Flub
{
init() { }

static fn beta() { }

static fn omega() { printf("owo\n") }
};
}

printf("four = %d\n", Foo::FOUR.value);

printf("hello\n");

using Foozle::Flub as Flubzle
Flubzle::omega();

printf("%d\n", Bar::bla(3));
printf("lmao\n");

let x = lim::int16::max;
printf("x = %x\n", x);

// let c = "a" + "b"
}
*/


import libc
import repro_3

// using libc as _

@entry fn main2()
{
// std::io::println("owo")
// owo::println("owo")
// uwu::owo::foozle()
// printf("owo\n")
repro_3::foozle(10)
}

Loading

0 comments on commit 12de5ae

Please sign in to comment.