Skip to content
Merged

4.0 #387

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
40b0b79
misc: do not include pre-releases in version badge
SuperFola Nov 28, 2022
62e6940
Merging with dev
SuperFola Nov 6, 2022
df4a1cd
chore: cleaning up the compiler code
SuperFola Jul 2, 2022
280c82b
chore: removed unused nodetype::closure
SuperFola Jul 2, 2022
c3b91b9
refactor: renaming methods and removing useless ones in the compiler
SuperFola Jul 2, 2022
1d1e7d1
feat: the bytecode reader works with the 4 bytes long instructions
SuperFola Jul 2, 2022
7ddbc02
fix: the bytecode reader CLI can now use --page in conjunction with -…
SuperFola Jul 2, 2022
d7f6bb4
feat: added the current instruction hex representation alongside its …
SuperFola Jul 2, 2022
f4f4300
updating the virtual machine to be able to use instructions on 4 bytes
SuperFola Jul 2, 2022
924ce22
removing the ArkScript String
SuperFola Mar 6, 2022
4aebf03
removing the custom string
SuperFola Mar 6, 2022
69cb2ab
removes code
SuperFola Mar 6, 2022
07754a8
adding fmtlib as a submodule targetting v7.1.3
SuperFola Mar 6, 2022
2acf71a
removing digPlaces and decPlaces from Utils.hpp/.cpp
SuperFola Mar 7, 2022
f2c6dfe
removing the .c_str() where they aren't needed
SuperFola Mar 7, 2022
6db3510
ci: should run for every pull request
SuperFola Jul 3, 2022
8e00513
removed deprecated code
SuperFola Jul 9, 2022
07c05e7
fix: using a specific version of the modules for the v4 and fixing th…
SuperFola Sep 5, 2022
f94aeaa
chore: formatting builtins.hpp
SuperFola Sep 5, 2022
1009ea7
fix: using build/arkscript as the main executable instead of build/ark
SuperFola Sep 5, 2022
18d27d4
fix: formatting word.hpp
SuperFola Sep 5, 2022
4772525
feat: adding closure comparison, per field
SuperFola Sep 22, 2022
28f34f9
chore: update changelog
SuperFola Sep 22, 2022
e2ad301
optimizing the closure comparison and adding tests
SuperFola Sep 24, 2022
34b381d
fixing changelog
SuperFola Nov 6, 2022
70a4847
formatting code
SuperFola Nov 6, 2022
e71ae00
fixing various merge related errors
SuperFola Nov 6, 2022
74fa0ed
feat: adding a very basic bloom filter to the scope to speed up the v…
SuperFola Dec 2, 2022
a9bc05a
chore: removing .cache from git
SuperFola Feb 19, 2023
958f987
chore: updating changelog
SuperFola Feb 19, 2023
eefd22b
fix: changing workflow status badge according to https://github.com/b…
SuperFola Feb 19, 2023
56b3d5f
docs: updating changelog
SuperFola Apr 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ on:
- 'LICENCE'
- '.gitignore'
pull_request:
branches: [dev]

env:
BUILD_TYPE: Debug
Expand Down Expand Up @@ -215,7 +214,6 @@ jobs:
shell: bash
run: |
mkdir -p artifact/lib/std
cp build/ark artifact
cp build/arkscript artifact
cp build/libArkReactor.* artifact
cp lib/*.arkm artifact/lib
Expand All @@ -227,7 +225,6 @@ jobs:
shell: bash
run: |
mkdir -p artifact/lib/std
cp build/$BUILD_TYPE/ark.exe artifact
cp build/$BUILD_TYPE/arkscript.exe artifact
cp build/$BUILD_TYPE/ArkReactor.dll artifact
cp lib/*.arkm artifact/lib
Expand Down Expand Up @@ -307,7 +304,7 @@ jobs:
run: |
mv artifact/cpp/out tests/cpp/
mv build/lib/*.arkm lib/
chmod u+x build/ark build/arkscript tests/cpp/out/*
chmod u+x build/arkscript tests/cpp/out/*

- name: Pre-test
if: startsWith(matrix.config.name, 'Windows')
Expand Down Expand Up @@ -343,7 +340,7 @@ jobs:
- shell: bash
run: |
mv build/lib/*.arkm lib/
chmod u+x build/ark build/arkscript
chmod u+x build/arkscript

- name: Update LLVM compilers
shell: bash
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ jobs:
shell: bash
run: |
mkdir -p artifact/lib/std
cp build/ark artifact
cp build/arkscript artifact
cp build/libArkReactor.* artifact
cp lib/*.arkm artifact/lib
Expand All @@ -128,7 +127,6 @@ jobs:
shell: bash
run: |
mkdir -p artifact/lib/std
cp build/$BUILD_TYPE/ark.exe artifact
cp build/$BUILD_TYPE/arkscript.exe artifact
cp build/$BUILD_TYPE/ArkReactor.dll artifact
cp lib/*.arkm artifact/lib
Expand Down Expand Up @@ -206,7 +204,7 @@ jobs:
run: |
mv artifact/cpp/out tests/cpp/
mv build/lib/*.arkm lib/
chmod u+x build/ark build/arkscript tests/cpp/out/*
chmod u+x build/arkscript tests/cpp/out/*

- name: Pre-test
if: startsWith(matrix.config.name, 'Windows')
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ afl/
# Folders
.vs/
.idea/
.cache/
build/
ninja/

Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
[submodule "lib/modules"]
path = lib/modules
url = https://github.com/ArkScript-lang/modules.git
[submodule "lib/String"]
path = lib/String
url = https://github.com/ArkScript-lang/String.git
[submodule "lib/clipp"]
path = lib/clipp
url = https://github.com/muellan/clipp.git
Expand All @@ -22,3 +19,6 @@
[submodule "lib/replxx"]
path = lib/replxx
url = https://github.com/AmokHuginnsson/replxx.git
[submodule "lib/fmt"]
path = lib/fmt
url = https://github.com/fmtlib/fmt.git
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Change Log

## [4.0.0] - 20XX-XX-XX
### Added
- more tests for the io builtins
- added lines and code coloration in the error context
- new dependency: fmtlib

### Changed
- instructions are on 4 bytes: 1 byte for the instruction, 1 byte of padding, 2 bytes for an immediate argument
- enhanced the bytecode reader and its command line interface
- added the padding/instruction/argumentation values when displaying instructions in the bytecode reader
- fixed underline bug in the error context
- the str:format functions now expects strings following this syntax: https://fmt.dev/latest/syntax.html
- more documentation about the compiler implementation
- more documentation about the virtual machine
- closures can be now be compared field per field: `(= closure1 closure2)` will work only if they have the same fields (name) and if the values match

### Removed
- removed unused `NodeType::Closure`
- removing the custom string, replacing it with std::string (the format engine of the custom string had a lot of memory leaks)
- removing the custom string, replacing it with std::string (the format engine of the custom string had a lot of memory leaks)
- `Utils::digPlaces` and `Utils::decPlaces` got removed as they were no longer needed
- removed deprecated code (`list:removeAt`, `ark` executable now replaced by `arkscript`)

## [3.5.0] - 2023-02-19
### Added
- added fuzzing tools and corpus for [AFL](https://github.com/AFLplusplus/AFLplusplus)
Expand Down
18 changes: 6 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ cmake_minimum_required(VERSION 3.9)
project(ark CXX)

# VERSION
set(ARK_VERSION_MAJOR 3)
set(ARK_VERSION_MINOR 4)
set(ARK_VERSION_MAJOR 4)
set(ARK_VERSION_MINOR 0)
set(ARK_VERSION_PATCH 0)

include(cmake/link_time_optimization.cmake)
Expand All @@ -26,7 +26,8 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# files needed for the library ArkReactor
file(GLOB_RECURSE SOURCE_FILES
${ark_SOURCE_DIR}/src/arkreactor/*.cpp)
${ark_SOURCE_DIR}/src/arkreactor/*.cpp
${ark_SOURCE_DIR}/lib/fmt/src/*.cc)

add_library(ArkReactor SHARED ${SOURCE_FILES})

Expand Down Expand Up @@ -92,15 +93,14 @@ endif()
# Link libraries

add_subdirectory("${ark_SOURCE_DIR}/lib/termcolor" EXCLUDE_FROM_ALL)
add_subdirectory("${ark_SOURCE_DIR}/lib/String/" EXCLUDE_FROM_ALL)

target_include_directories(ArkReactor
PUBLIC
"${ark_SOURCE_DIR}/lib/utf8_decoder/"
"${ark_SOURCE_DIR}/lib/picosha2/"
"${ark_SOURCE_DIR}/lib/String/include/")
"${ark_SOURCE_DIR}/lib/fmt/include")

target_link_libraries(ArkReactor PUBLIC termcolor ArkScriptString)
target_link_libraries(ArkReactor PUBLIC termcolor)

if (UNIX OR LINUX)
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG)
Expand Down Expand Up @@ -184,7 +184,6 @@ if (ARK_BUILD_EXE)
${ark_SOURCE_DIR}/src/arkscript/main.cpp)

add_executable(arkscript ${EXE_SOURCES})
add_executable(ark ${EXE_SOURCES})

if (MSVC)
# Disable warnings for lib/replxx
Expand All @@ -199,15 +198,10 @@ if (ARK_BUILD_EXE)
add_subdirectory("${ark_SOURCE_DIR}/lib/clipp" EXCLUDE_FROM_ALL)

target_include_directories(arkscript PUBLIC "${ark_SOURCE_DIR}/src/arkscript/")
target_include_directories(ark PUBLIC "${ark_SOURCE_DIR}/src/arkscript/")

target_link_libraries(arkscript PUBLIC ArkReactor replxx clipp termcolor)
target_link_libraries(ark PUBLIC ArkReactor replxx clipp termcolor)

target_compile_features(arkscript PRIVATE cxx_std_17)
target_compile_features(ark PRIVATE cxx_std_17)

enable_lto(ark)
enable_lto(arkscript)

# Installs the arkscript executable.
Expand Down
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ArkScript ![Latest version](https://img.shields.io/github/v/release/arkscript-lang/ark?include_prereleases&style=for-the-badge)
# ArkScript ![Latest version](https://img.shields.io/github/v/release/arkscript-lang/ark?style=for-the-badge)

![Code size](https://img.shields.io/github/languages/code-size/arkscript-lang/ark?style=for-the-badge&logo=github)
![Downloads](https://img.shields.io/github/downloads/arkscript-lang/ark/total?color=%2324cc24&style=for-the-badge&logo=github)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/ArkScript-lang/Ark/CMake?logo=cmake&style=for-the-badge)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/ArkScript-lang/Ark/ci.yml?logo=cmake&style=for-the-badge&branch=4.0)

<img align="right" src="images/ArkTransparent-by-mazz.png" width=200px alt="ArkScript log by Mazz">

Expand Down Expand Up @@ -173,15 +173,17 @@ DESCRIPTION
ArkScript programming language

SYNOPSIS
arkscript -h
arkscript -v
arkscript --dev-info
arkscript -e <expression>
arkscript -c <file> [-d]
arkscript -bcr <file> -on
arkscript -bcr <file> [-(a|st|vt)] [-s <start> <end>]
arkscript -bcr <file> [-cs] [-p <page>]
arkscript <file> [-d] [-L <lib_dir>]
arkscript -h
arkscript -v
arkscript --dev-info
arkscript -e <expression>
arkscript -c <file> [-d]
arkscript -bcr <file> -on
arkscript -bcr <file> -a [-s <start> <end>]
arkscript -bcr <file> -st [-s <start> <end>]
arkscript -bcr <file> -vt [-s <start> <end>]
arkscript -bcr <file> [-cs] [-p <page>] [-s <start> <end>]
arkscript <file> [-d] [-L <lib_dir>]

OPTIONS
-h, --help Display this message
Expand All @@ -195,9 +197,9 @@ OPTIONS
-a, --all Display all the bytecode segments (default)
-st, --symbols Display only the symbols table
-vt, --values Display only the values table
-s, --slice Select a slice of instructions in the bytecode
-cs, --code Display only the code segments
-p, --page Set the bytecode reader code segment to display
-s, --slice Select a slice of instructions in the bytecode
-L, --lib Set the location of the ArkScript standard library. Paths can be
delimited by ';'

Expand Down
4 changes: 2 additions & 2 deletions examples/99bottles.ark
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@

(mut n i)
(while (> n 1) {
(print (str:format "%% Bottles of beer on the wall\n%% bottles of beer\nTake one down, pass it around" n n))
(print (str:format "{} Bottles of beer on the wall\n{} bottles of beer\nTake one down, pass it around" n n))
(set n (- n 1))
(print (str:format "%% Bottles of beer on the wall." n))})
(print (str:format "{} Bottles of beer on the wall." n))})
6 changes: 3 additions & 3 deletions examples/blockchain.ark
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@
(let new (json:fromString request))
(set nodes_transactions (append nodes_transactions new))
(print "New transaction")
(print (str:format "FROM: %%" (json:get new "from")))
(print (str:format "TO: %%" (json:get new "to")))
(print (str:format "AMOUNT: %%" (json:get new "amount")))
(print (str:format "FROM: {}" (json:get new "from")))
(print (str:format "TO: {}" (json:get new "to")))
(print (str:format "AMOUNT: {}" (json:get new "amount")))

# return value
[200 "transaction submission successful" "text/plain"]}))
Expand Down
6 changes: 3 additions & 3 deletions examples/run-all
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Purple='\033[0;35m'
Cyan='\033[0;36m'
White='\033[0;37m'

maybe_ark=$(which ark)
maybe_ark=$(which arkscript)
if [[ $($maybe_ark --help | grep "ArkScript programming language") != "" ]]; then
ark=$maybe_ark
elif [ -f ../build/ark ]; then
ark=../build/ark
elif [ -f ../build/arkscript ]; then
ark=../build/arkscript
else
echo -e "${Red}Couldn't find ark${Reset}"
exit 1
Expand Down
17 changes: 8 additions & 9 deletions include/Ark/Builtins/Builtins.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* @brief Host the declaration of all the ArkScript builtins
* @version 0.1
* @date 2020-10-27
*
*
* @copyright Copyright (c) 2020-2021
*
*
*/

#ifndef ARK_BUILTINS_BUILTINS_HPP
Expand Down Expand Up @@ -35,13 +35,12 @@ namespace Ark::internal::Builtins
// ------------------------------
namespace List
{
Value reverseList(std::vector<Value>& n, VM* vm); // list:reverse, single arg
Value findInList(std::vector<Value>& n, VM* vm); // list:find, 2 arguments
Value removeAtList(std::vector<Value>& n, VM* vm); // list:removeAt, 2 arguments -- DEPRECATED
Value sliceList(std::vector<Value>& n, VM* vm); // list:slice, 4 arguments
Value sort_(std::vector<Value>& n, VM* vm); // list:sort, 1 argument
Value fill(std::vector<Value>& n, VM* vm); // list:fill, 2 arguments
Value setListAt(std::vector<Value>& n, VM* vm); // list:setAt, 3 arguments
Value reverseList(std::vector<Value>& n, VM* vm); // list:reverse, single arg
Value findInList(std::vector<Value>& n, VM* vm); // list:find, 2 arguments
Value sliceList(std::vector<Value>& n, VM* vm); // list:slice, 4 arguments
Value sort_(std::vector<Value>& n, VM* vm); // list:sort, 1 argument
Value fill(std::vector<Value>& n, VM* vm); // list:fill, 2 arguments
Value setListAt(std::vector<Value>& n, VM* vm); // list:setAt, 3 arguments
}

namespace IO
Expand Down
8 changes: 0 additions & 8 deletions include/Ark/Builtins/BuiltinsErrors.inl

This file was deleted.

8 changes: 3 additions & 5 deletions include/Ark/Compiler/Common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* @file Common.hpp
* @author Alexandre Plateau (lexplt.dev@gmail.com)
* @brief Common code for the compiler
* @version 0.3
* @version 0.4
* @date 2021-10-02
*
* @copyright Copyright (c) 2021
* @copyright Copyright (c) 2021-2022
*
*/

Expand Down Expand Up @@ -34,21 +34,19 @@ namespace Ark::internal
String,
Number,
List,
Closure,
Macro,
Spread,
Unused
};

constexpr std::array<std::string_view, 11> nodeTypes = {
constexpr std::array<std::string_view, 10> nodeTypes = {
"Symbol",
"Capture",
"GetField",
"Keyword",
"String",
"Number",
"List",
"Closure",
"Macro",
"Spread",
"Unused"
Expand Down
Loading