Skip to content

Commit

Permalink
Merge pull request #291 from dictu-lang/develop
Browse files Browse the repository at this point in the history
Release 0.11.0
  • Loading branch information
Jason2605 authored Oct 20, 2020
2 parents 4c8e4f7 + 5463d47 commit fa60667
Show file tree
Hide file tree
Showing 136 changed files with 5,981 additions and 550 deletions.
140 changes: 100 additions & 40 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,105 @@ on:
- master

jobs:
test-ubuntu:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-16.04, ubuntu-20.04]
test-ubuntu:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-16.04, ubuntu-20.04]

steps:
- uses: actions/checkout@v2
- name: Make dictu and run tests (No HTTP)
run: |
make debug DISABLE_HTTP=1
./dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
- name: Remove build directory
run: |
rm -rf build
- name: Make dictu and run tests (HTTP)
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev
make debug
./dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
test-mac:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macOS-latest]
steps:
- uses: actions/checkout@v2
- name: Make dictu and run tests (No HTTP)
run: |
make debug DISABLE_HTTP=1
./dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
- name: Remove build directory
run: |
rm -rf build
- name: Make dictu and run tests (HTTP)
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev
make debug
./dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
test-ubuntu-cmake:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-16.04, ubuntu-20.04]

steps:
- uses: actions/checkout@v2
- name: Make dictu and run tests (No HTTP)
run: |
make debug DISABLE_HTTP=1
./dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
- name: Remove build directory
run: |
rm -rf build
- name: Make dictu and run tests
run: |
make debug
./dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
steps:
- uses: actions/checkout@v2
- name: Make dictu and run tests (No HTTP)
run: |
cmake -DCMAKE_BUILD_TYPE=Debug -DDISABLE_HTTP=1 -B ./build
cmake --build ./build
./build/Dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
- name: Remove build directory
run: |
rm -rf build
- name: Make dictu and run tests (HTTP)
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev
cmake -DCMAKE_BUILD_TYPE=Debug -B ./build
cmake --build ./build
./build/Dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
test-mac:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macOS-latest]

steps:
- uses: actions/checkout@v2
- name: Make dictu and run tests (No HTTP)
run: |
make debug DISABLE_HTTP=1
./dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
- name: Remove build directory
run: |
rm -rf build
- name: Make dictu and run tests
run: |
make debug
./dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
test-mac-cmake:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macOS-latest]

steps:
- uses: actions/checkout@v2
- name: Make dictu and run tests (No HTTP)
run: |
cmake -DCMAKE_BUILD_TYPE=Debug -DDISABLE_HTTP=1 -B ./build
cmake --build ./build
./build/Dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
- name: Remove build directory
run: |
rm -rf build
- name: Make dictu and run tests
run: |
cmake -DCMAKE_BUILD_TYPE=Debug -B ./build
cmake --build ./build
./build/Dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
test-windows-cmake:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2019, windows-latest]

steps:
- uses: actions/checkout@v2
- name: Make dictu and run tests (No HTTP No Linenoise)
run: |
cmake -DCMAKE_BUILD_TYPE=Debug -DDISABLE_HTTP=1 -DDISABLE_LINENOISE=1 -B build
cmake --build build
build\Debug\Dictu.exe tests/runTests.du
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@ compile_commands.json
venv/

cmake-build-debug/CMakeFiles/clion-log.txt

docs/.jekyll-cache/
docs/_site/
cmake-build-debug/

cmake-build-release/
51 changes: 51 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
cmake_minimum_required(VERSION 3.16.5)
project(Dictu C)

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS ON)

set(DISABLE_HTTP OFF CACHE BOOL "Determines if HTTPS based features are compiled. HTTPS based features require cURL.")
set(DISABLE_LINENOISE OFF CACHE BOOL "Determines if the REPL uses linenoise. Linenoise requires termios.")

file(GLOB_RECURSE sources "c/*.c")
file(GLOB_RECURSE headers "c/*.h")
set(libraries)

if(DISABLE_HTTP)
list(FILTER sources EXCLUDE REGEX "http.c")
list(FILTER headers EXCLUDE REGEX "http.h")
add_compile_definitions(DISABLE_HTTP)
else()
list(APPEND libraries curl)
endif()

if(DISABLE_LINENOISE)
add_compile_definitions(DISABLE_LINENOISE)
endif()

if(WIN32)
# ws2_32 is required for winsock2.h to work correctly
list(APPEND libraries ws2_32)
else()
list(APPEND libraries m)
endif()

if(MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
set(CMAKE_C_FLAGS "/WX /W1")
set(CMAKE_C_FLAGS_DEBUG "/Zi")
set(CMAKE_C_FLAGS_RELEASE "/O2")
else()
set(CMAKE_C_FLAGS "-Wall -Wextra -Werror -Wshadow -Wunused-function -Wunused-macros")
set(CMAKE_C_FLAGS_DEBUG "-O0 -g")
set(CMAKE_C_FLAGS_RELEASE "-O3 -flto")
endif()

if(CMAKE_BUILD_TYPE MATCHES Debug)
add_compile_definitions(DEBUG DEBUG_STRESS_GC DEBUG_FINAL_MEM)
endif()

add_executable(${PROJECT_NAME} ${sources} ${headers})

target_link_libraries(${PROJECT_NAME} ${libraries})
44 changes: 41 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,55 @@ built upon the [craftinginterpreters tutorial](http://www.craftinginterpreters.c
Dictu means `simplistic` in Latin.

### Dictu documentation
Documentation for Dictu can be found [here](https://jason2605.github.io/Dictu/)
Documentation for Dictu can be found [here](https://dictu-lang.com/)

## Running Dictu
Dictu currently has two options when building, there is a CMakeLists file included so the build files can be generated with
CMake or there is an included makefile for users that are more familiar with that.

### CMake
```bash
$ git clone https://github.com/Jason2605/Dictu.git
$ git clone https://github.com/dictu-lang/Dictu.git
$ cd Dictu
$ cmake -DCMAKE_BUILD_TYPE=Release -B ./build
$ cmake --build ./build
$ ./build/Dictu
```

#### Compiling without HTTP

The HTTP class within Dictu requires [cURL](https://curl.haxx.se/) to be installed when building the interpreter. If you wish to
build Dictu without cURL, and in turn the HTTP class, build with the `DISABLE_HTTP` flag.

```bash
$ git clone https://github.com/dictu-lang/Dictu.git
$ cd Dictu
$ cmake -DCMAKE_BUILD_TYPE=Release -DDISABLE_HTTP=1 -B ./build
$ cmake --build ./build
$ ./build/Dictu
```

#### Compiling without linenoise
[Linenoise](https://github.com/antirez/linenoise) is used within Dictu to enhance the REPL, however it does not build on windows
systems so a simpler REPL solution is used.

```bash
$ git clone https://github.com/dictu-lang/Dictu.git
$ cd Dictu
$ cmake -DCMAKE_BUILD_TYPE=Release -DDISABLE_LINENOISE=1 -B ./build
$ cmake --build ./build
$ ./build/Dictu
```

### Makefile
```bash
$ git clone https://github.com/dictu-lang/Dictu.git
$ cd Dictu
$ make dictu
$ ./dictu examples/guessingGame.du
```

### Compiling without HTTP
#### Compiling without HTTP

The HTTP class within Dictu requires [cURL](https://curl.haxx.se/) to be installed when building the interpreter. If you wish to
build Dictu without cURL, and in turn the HTTP class, build with the `DISABLE_HTTP` flag.
Expand Down
2 changes: 2 additions & 0 deletions c/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
#define DEBUG_TRACE_GC
#define DEBUG_TRACE_MEM

#ifndef _MSC_VER
#define COMPUTED_GOTO
#endif

#undef DEBUG_PRINT_CODE
#undef DEBUG_TRACE_EXECUTION
Expand Down
Loading

0 comments on commit fa60667

Please sign in to comment.