ArkScript is a small, fast, functional and scripting language for C++ projects

Overview

ArkScript Latest version

Code size Downloads GitHub Workflow Status

Nota bene: the project is referred as "Ark" and as "ArkScript". The official public name is "ArkScript" since "Ark" is already being used by another language

Key features

ArkScript is

  • small: the compiler and the virtual machines fit under 8000 lines, but also small in terms of keywords (it has only 10)!
  • a scripting language: it's very easy to embed it in your application. The builtin construction is quite easy to understand, so adding your own functions to the virtual machine is effortless
  • portable: it produces a bytecode which is run by its virtual machine, the same way Java does it (with a smaller memory footprint)
  • a functional language: every parameter is passed by value, everything is immutable unless you use mut to specify your need of mutability
  • powerful: it can handle object-oriented programming in a very elegant way with its closures and explicit captures (see examples/closures.ark)
  • promoting functionalities before performances: expressiveness often brings more productivity, even though performances aren't left behind
  • easy to compile: it takes less than 200ms to compile and check a complex code with a lot of branches and sub-branches of 200 lines
  • a Lisp-like, but with fewer parentheses: [...] is expanded to (list ...) and {} to (begin ...). More shorthands will come in the future
  • extensible: it is very easy to create a C++ module to use it in the language, adding functionalities

Also it has:

  • macros: if/else, values, and functions
  • a REPL with autocompletion and coloration
  • a growing standard library, composed of ArkScript code (under lib/std/) and C++ (under lib/ext/)
  • a lot of unit tests (but never enough), which are ran before every release to ensure everything work as intended
  • docker images to try the language without compiling it:
    • stable, images built after each release
    • nightly, image built after each commit

Examples

Fibonacci suite

(let fibo (fun (n)
    (if (< n 2)
        n
        (+ (fibo (- n 1)) (fibo (- n 2))))))

(print (fibo 28))  # display 317811

More or less game

(import "random.arkm")
(import "Math.ark")

(let number (mod (abs (random)) 10000))

(mut value 0)
(mut tries 0)
(mut continue true)

(while continue {
    (set value (toNumber (input "Input a numeric value: ")))

    (if (< value number)
        (print "More!")
        (if (= value number)
            {
                (print "Bingo!")
                (set continue false)
            }
            (print "Less!")))

    (set tries (+ 1 tries))
})

(print "You won in " tries " tries")

More examples are available inside examples/.

Installation

You can either use docker:

docker pull arkscript/stable:latest

# or use the most updated repo
docker pull arkscript/nightly:latest

or build the project with CMake and install it with CMake:

cmake --install build

Contributing

  • First, fork the repository
  • Then, clone your fork: git clone [email protected]:username/Ark.git
  • Create a branch for your feature: git checkout -b feat-my-awesome-idea
  • When you're done, push it to your fork and submit a pull request!

Don't know what to work on? No worries, we have a list of things to do 😉

Related projects

We have other projects tightly related to ArkScript, which aren't necessarily C++ oriented:

Our beloved contributors

Full list here.

Coding guidelines for contributing

See C++ Coding guidelines if you want to contribute to ArkScript compiler / runtime.

Also, see ArkScript Coding guidelines for other files, written in ArkScript.

For performance reasons, some functions might be written in C++, in include/Ark/Builtins/Builtins.hpp and src/Builtins/.

Code structure

ArkScript code structure

Building

Dependencies

  • C++17
  • CMake >= 3.12
  • Visual Studio >= 11 (on Windows)
  • On macOS versions prior to 10.15, libc++ lacks filesystem in the standard library.
    • Install a newer compiler using Homebrew: brew install gcc && brew link gcc
    • Pass compiler path to cmake in the build step: -DCMAKE_CXX_COMPILER=/usr/local/bin/g++-9

All the external libraries we use are already included in thirdparties.

Through CMake

Different CMake switches are available to customize the build:

  • -DARK_BUILD_EXE to generate an executable, defaults to Off, building a shared library only
  • -DARK_ENABLE_SYSTEM to enable sys:exec (execute shell commands without restrictions), defaults to On
  • -DARK_PROFILER to enable the coz profiler, defaults to Off
  • -DARK_PROFILER_COUNT to count every creation/copy/move of the internal value type, defaults to Off
  • -DARK_PROFILER_MIPS to enable the MIPS counting, defaults to Off
  • -DARK_NO_STDLIB to avoid the installation of the ArkScript standard library
  • -DARK_BUILD_MODULES to trigger the modules build
# first, clone it
git clone --depth=50 --branch=dev https://github.com/ArkScript-lang/Ark.git
cd Ark
git submodule update --init --recursive
# building Ark
cmake . -Bbuild -DCMAKE_BUILD_TYPE=Release -DARK_BUILD_EXE=On
cmake --build build --config Release
# installing Ark (might need administrative privileges)
cmake --install build --config Release

Desired output of arkscript --help:

DESCRIPTION
        ArkScript programming language

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

OPTIONS
        -h, --help                  Display this message
        -v, --version               Display ArkScript version and exit
        --dev-info                  Display development information and exit
        -e, --eval                  Evaluate ArkScript expression
        -c, --compile               Compile the given program to bytecode, but do not run
        -d, --debug...              Increase debug level (default: 0)
        -bcr, --bytecode-reader     Launch the bytecode reader
        -on, --only-names           Display only the bytecode segments names and sizes
        -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
        -L, --lib                   Set the location of the ArkScript standard library

LICENSE
        Mozilla Public License 2.0

Performances

See https://github.com/ArkScript-lang/benchmarks

Games

You can find a snake created in ArkScript in the folder examples/games/snake (run it from there, otherwise it won't find the font and the sprites ; you won't need to install the SFML).

ArkSnake

Controls are the arrows (left, right, up and down), the game closes itself when you successfully collect the 3 apples.

The donators

Huge thanks to those people for their donations to support the project:

Credits

This project was inspired by gameprogramingpatterns and ofan lisp.cpp

Copyright and Licence information

Copyright (c) 2019-2021 Alexandre Plateau. All rights reserved.

This ArkScript distribution contains no GNU GPL code, which means it can be used in proprietary projects.

Comments
  • Builtins and std lib modules

    Builtins and std lib modules

    This issue will be used to keep track of the needed builtins and std lib functionnalities for the 3.1.0

    List

    • [x] (zip list1 list2)
    • [x] (map func list1)
    • [x] sorting algorithms
    • [x] reverse array
    • [x] find object in array
    • [x] delete element at index and return new list
    • [x] (slice array from_index to_index step)
    • [x] implement forEach (already done in examples/for-each.ark, but it can be greatly improved)

    Dictionnary

    • [x] ~~dictionnary implementation using closures~~ see the json module

    String

    • [ ] regexes
    • [x] reverse string
    • [x] find substring in string
    • [x] (slice string from_index to_index step)
    • [x] (removeAtStr string index)

    Network

    • [ ] create socket
      • [ ] TCP/IP
      • [ ] UDP
    • [ ] close socket
    • [ ] send data
    • [ ] receive data
    • [ ] make ARP request
    • [ ] make ICMP packets

    Mathematics

    • [x] trigonometrics
      • [x] cos, arccos
      • [x] sin, arcsin
      • [x] tan, arctan
    • [x] exp, log
    • [x] pow (can be implemented in ArkScript with exp and log)
    • [x] sqrt (can be implemented in ArkScript with pow)
    • [x] ceil, floor, round
    • [x] sum (elements from list)
    • [x] is infinite, is nan
    • [x] pi, e, tau, inf, nan

    ~~SFML~~

    • [x] ~~Graphics~~
    • [ ] ~~Audio~~
    • [ ] ~~Window~~
    • [ ] ~~System~~
    • [ ] ~~Network~~

    Not part of the standard library anymore, was moved to https://github.com/SuperFola/arksfml

    enhancement virtual machine 
    opened by SuperFola 19
  • Adding macros

    Adding macros

    I think we should consider adding macros to the language, since it would have been (imo) very useful for some programs, and also to extend the language (eg if we want to define a forEach "keyword", which wouldn't use a function behind but directly copy the code doing the forEach thing)

    enhancement help wanted question compiler 
    opened by SuperFola 16
  • Add more arguments/options to the bytecode reader to select code segments

    Add more arguments/options to the bytecode reader to select code segments

    The idea would be to be able to select a specifc code segment given its PP (page pointer), also to slice a code segment (some can be as long as 2000 instructions, it could be great to say "hey I want the code segment 12, from instruction n°144 to instruction n°244".

    Could also be great to be able to slice the constants table/symbols table and also to print only the constants table/symbols table.

    Needed files are located in include/Ark/Compiler/BytecodeReader.hpp and src/Compiler/BytecodeReader.cpp

    good first issue 
    opened by SuperFola 10
  • Refactor our cmake configs

    Refactor our cmake configs

    Currently, our cmake configs are quite bad.

    Ark's CMakeLists.txt is more than 200 lines, doing heavy things, abusing mecanisms like include_directories instead of target_include_directories, which is (AFAIK) non-idiomatic CMake.

    Also I solved a problem where compilation flags weren't synchronized between projects (ArkScript and our modules) but it uses global properties and I'm guessing that it's quite bad.

    We could refactor the cmake configs to have one per directory and use target_sources and source_groups (see https://github.com/GentenStudios/Phoenix/, it's using this practice, allowing easy development in VS by showing the source groups correctly)

    help wanted good first issue 
    opened by SuperFola 9
  • Update search paths

    Update search paths

    Excuse the minor overhaul. But, since the environment variable is used instead of the integrated "libdir," I've removed/replaced those occurrences. There is currently no default value for ARKSCRIPT_PATH. The approach for setting that is up to you.

    Should fix #310

    opened by maxnatamo 8
  • Better error messages for builtins / modules functions

    Better error messages for builtins / modules functions

    It would be great to generate coherent and consistent error messages, following something like

    1. functionName: argumentName must be of type typeName.
    functionName: needs argumentCount argument(s), got actualArgumentCount.
      -> arg1Name (wanted type) was arg1Value (of type arg1Type)
      -> arg2Name (wanted type) was arg2Value (of type arg2Type)
         [nota: this could be color coded to tell if the constraint was satisfied or not]
    
    enhancement virtual machine modules hacktoberfest priority/medium 
    opened by SuperFola 7
  • REPL segfaulting in a few situations

    REPL segfaulting in a few situations

    Describe the bug The REPL segfaults when:

    1. The input is only spaces
    2. The input is only a comment (starts by optional spaces and then #)

    Expected behavior Same behavior as if the user had directly pressed <ENTER>: "nothing" (new line and new prompt)

    Relevant GIF GIF

    Notes (1 & 2): Here is the code handling the REPL when the user simply presses <ENTER>:

    if (line.length() == 0)
    {
        std::cout << (new_command ? new_prompt : continuing_prompt);
        continue;
    }
    

    It only checks that the line is empty. Maybe it should instead strip whitespaces ahead (spaces and tabs notably), and then conclude: If the resulting line starts has a length of 0 or starts with # then: ...

    I'm only doing an issue as I have no idea how to do this in C++

    EDIT: The GIF also shows how {} or the equivalent (begin ) block also causes the REPL to segfaults. But this is the current behavior of Arkscript itself and isn't "the fault" of the REPL implementation.

    bug parser compiler repl 
    opened by Unactived 7
  • Investigate why MacOS builds fail sometimes

    Investigate why MacOS builds fail sometimes

    It seems like that half the time, the MacOS builds of ArkScript are failing and triggering segmentation faults. Relaunching the jobs "fixes" the problem somehow.

    Alas I don't have a Mac to investigate this problem.

    Something important to note (IMO): the MacOS CI is using Clang 12, but the Ubuntu CI are only going as far as Clang 11. Could it be a problem with Clang 12? Also, the Clang builds on Ubuntu never fail to run (I have tested them and debugged them, as I am running both Linux and Windows).

    bug help wanted 
    opened by SuperFola 6
  • Update the standard library search paths

    Update the standard library search paths

    On Linux, we should search for the standard library under /usr/lib and /usr/local/lib, otherwise use the ARKSCRIPT_PATH environment variable.

    On Windows, we should search under C:/Program Files/Ark, otherwise use the environment variable.

    Details

    The environment variable ARKSCRIPT_PATH should point to a folder containing the standard library:

    ARKSCRIPT_PATH/
    |__ std/
    |   |__ String.ark
    |   |__ List.ark
    |   |__ ...
    |__ modules/
    |__ ...
    

    The file where the modifications will take place is src/arkreactor/VM/State.cpp.


    Checklist

    • [ ] update the website documentation accordingly
    • [ ] update the readme if needed
    • [ ] update the doxydoc if needed
    • [ ] should work without the environment variable ARKSCRIPT_PATH
    • [ ] should work with the environment variable
    enhancement hacktoberfest priority/medium 
    opened by SuperFola 6
  • Use only necessary files for installation in Dockerfile

    Use only necessary files for installation in Dockerfile

    Reduced 456MB to 449MB.

    Inspired by the discussion from #148. Can we make it even smaller? What does cmake --install build --config Release actually do?

    opened by yardenshoham 6
  • Question: should we put the modules in another repository?

    Question: should we put the modules in another repository?

    Should we put the modules in another repository?

    I'm asking this because the repository will definitely grow a lot with all the modules we are going to add, and when someone wants to start experimenting on a project, often they don't like having to download a bunch of things that they aren't going to use.

    Having like a module store would be quite cool, what do you think?

    documentation enhancement help wanted question 
    opened by SuperFola 6
Releases(v4.0.0-0.1)
  • v4.0.0-0.1(Nov 28, 2022)

    [4.0.0-0.1] - 2022-11-28

    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)
    Source code(tar.gz)
    Source code(zip)
    macos-clang-12.zip(8.20 MB)
    ubuntu-clang-11.zip(12.50 MB)
    ubuntu-gcc-11.zip(13.00 MB)
    windows-msvc-19.zip(1.59 MB)
  • v3.4.0(Sep 12, 2022)

    Added

    • added new async and await builtins
      • they can access the outer scope
    • added methods to create and destroy an execution context and a future in the VM
    • added new CLI option --ast to generate JSON from the generated abstract syntax tree
    • added an AST to JSON compiler
    • added warnings on unused functions/quotes and statements without any effect

    Changed

    • printing a closure will now print its fields instead of Closure<1432>
    • macros are always evaluated, even when they aren't any user defined macro
    • argcount works on symbols and anonymous functions

    Deprecated

    • deprecating Value VM::resolve(const Value* val, Args&&... args)

    Removed

    • removed the std::ostream& operator<< of the Value, now using the .toString(stream, vm reference)
    • removed the global VM lock
    • removed coz and ARK_PROFILER
    Source code(tar.gz)
    Source code(zip)
    linux-clang-11.zip(2.80 MB)
    linux-gcc-11.zip(2.79 MB)
    macos-clang-12.zip(2.69 MB)
    windows-installer.exe(2.08 MB)
    windows-msvc-19.zip(962.64 KB)
  • v3.3.0(Jul 2, 2022)

    Added

    • running the modules tests in the CI
    • new bytecode instruction POP, removing the last value from the stack
    • more documentation about ArkScript and its modules
    • more tests for the io builtins
    • added lines and code coloration in the error context
    • added documentation about the compiler implementation
    • added documentation about the virtual machine
    • ArkScript now supports LTO if the compiler can do it

    Changed

    • fixed underline bug in the error context
    • changing the way we count received arguments in arity / type errors for failed function call
    • the CLI can now take a list of paths to the standard library, separated by ';'
    Source code(tar.gz)
    Source code(zip)
    linux-clang-10.zip(2.74 MB)
    linux-gcc-8.zip(2.79 MB)
    linux-gcc-9.zip(2.71 MB)
    macos-clang-12.zip(2.64 MB)
    windows-installer.exe(2.05 MB)
    windows-msvc-17.zip(907.41 KB)
    windows-msvc-19.zip(907.40 KB)
  • v3.1.3(Jan 29, 2022)

    Added

    • adding an ExecutionContext to host the pointers (instruction, page, stack) and execution related structures (stack, locals, scopes), to ease the transition to a parallelized VM
      • the VM can have multiple independant context running on the same bytecode
    • the VM now takes a reference to an Ark::State instead of a raw non-owning pointer
    • adding ARK_PROFILER_MIPS to toggle instruction per second calculation
    • adding new way to typecheck in builtins
    • new CI build step now running valgrind to check for memory leaks
    • new type checker (to be used by builtins)
    • better type errors generation (with the list of arguments, if they are matching or not, and more)

    Changed

    • splitting Utils.hpp into multiple files for easier maintenance and contextualisation
    • reserving a default scope size of 3, which yields really good performance results compared to nothing being reserved
    • upgrading the builtins error handling to use the BetterTypeError
    • the VM now displays the debug info (ip, pp, sp) at the end of the backtrace instead of the beginning

    Removed

    • BetterTypeError has been removed in favor of a type checker using templates and an error generator

    Deprecated

    • deprecating VM(State*) in favor of VM(State&)
    Source code(tar.gz)
    Source code(zip)
    linux-clang-10.zip(2.75 MB)
    linux-gcc-8.zip(2.78 MB)
    linux-gcc-9.zip(2.75 MB)
    macos-clang-12.zip(2.62 MB)
    windows-installer.exe(2.04 MB)
    windows-msvc-17.zip(894.78 KB)
    windows-msvc-19.zip(894.78 KB)
  • v3.1.2(Nov 2, 2021)

    Added

    • adding support for append_in_place, concat_in_place, pop_list and pop_list_in_place in the bytecode reader
    • added page_ptr(int) in the compiler to replace &page(int)
    • added literals _u8 and _u16
    • added table overflow detection in the compiler, to avoid creating unusable bytecode (checks if the symbols/values table is full or not)
    • new Installer.iss (inno setup script) to generate a Windows installer
    • new exceptions for type errors

    Changed

    • using doc_formatting.first_column instead of doc_formatting.start_column when displaying the CLI help
    • brand new cmake build system
    • renaming Ark/Config.hpp to Ark/Platform.hpp
    • refactored compiler handling of keywords
    • removed using Inst_t = uint8_t in the compiler
    • moved everything related to the AST in Ark/Compiler/AST/
    • moved everything related to the macros in Ark/Compiler/Macros/
    • renamed unclear file CValue to ValTableElem
    • the parser is now an internal class
    • the AST Optimizer was moved to Compiler/AST
    • changed the ARKSCRIPT_PATH to be a collection of paths to look into, separated by ;
    • updating replxx to avoid a bug when compiling with clang

    Removed

    • removed ARK_SCOPE_DICHOTOMY flag so that scopes don't use dichotomic search but a linear one, since it proved to be faster on small sets of values. This goes toward prioritizing small functions, and code being cut in multiple smaller scopes
    • removing download-arkscript.sh from the repo
    • removed isFraction, isInteger, isFloat from Ark/Utils.hpp (worked on strings and used regex)
    • removed mpark variant to use standard variant
    • Ark::FeatureFunctionArityCheck was removed, making arity checks mandatory
    Source code(tar.gz)
    Source code(zip)
    linux-clang-10.zip(2.73 MB)
    linux-gcc-8.zip(2.76 MB)
    linux-gcc-9.zip(2.73 MB)
    macos-clang-12.zip(2.61 MB)
    windows-installer.exe(2.08 MB)
    windows-msvc-17.zip(995.90 KB)
    windows-msvc-19.zip(995.91 KB)
  • v3.1.1(Sep 19, 2021)

    Added

    • ArkDoc documentation for the builtins
    • Now using clang-format to ensure the code is correctly formatted

    Changed

    • the macro processor can now handle multiple macro definitions in a if-macro: !{if true { !{a 1} !{b 2} }} is finally working

    Deprecated

    • ark command is now marked as deprecated, in favor of arkscript
    Source code(tar.gz)
    Source code(zip)
    linux64.zip(3.39 MB)
    win64.zip(4.71 MB)
  • v3.1.0(Jun 29, 2021)

    Change Log

    [3.1.0] - 2021-06-29

    Added

    • adding of new string function for manipulation of utf8 string (str:ord and str:chr)
    • utf8 support for lexer
    • UserType::del(), used only by the virtual machine to free memory
    • a new unique stack based on a std::array<Value, ARK_STACK_SIZE>, the default stack size being 8192
    • more profiling tests
    • more options on the display() method of the bytecode reader, allowing us to selecto segment of bytecode instead of displaying everything
    • added a new token type: Spread ; it handles ...identifier, needed in macros
    • the parser can now handle macros definitions
    • macros are being handled right after the parsing, before the AST optimizer can run
      • if macros: !{if compile-time-value then [optional else]}
      • values macros: !{name value}
      • functions macros: !{name (a b c ...args) body}
    • sys:platform, containing the current platform name
    • updated the CLI so that we can slice the bytecode when displaying it
    • the bytecode reader can now display
      • all the segments
      • only the values segment
      • only the symbols segment
      • only the code segment (all of them or a given one)
      • only the segments' titles and length
    • verifying that we give enough arguments
    • we can now import macros from other files
    • undefining macros is now possible by using !{undef macro_name}
    • str:join added in the standard library
    • str:split can now take longer separators
    • added symcat in macros to concatenate a symbol and a number/string/symbol to create a new one
    • added argcount in macros to count (at compile time) the number of arguments of a function
    • fixed a bug where (bloc) and (print bloc), given a !{bloc value} macro, didn't give the same result (one was applied, the other was partial)
    • new module to manipulate bits: bitwise
    • enhanced standard library

    Changed

    • updating doxyfile and some docstrings
    • updating the download script
    • enhancing examples
    • creating a Scope allocates 4 pairs instead of 2, reducing the number of reallocations needed
    • tailOf renamed to tail and headOf to head ; no need to keep the relics of the past
    • headOf (now head) returns the real head of a container (List or String), the first element (nil if the list is empty, "" if the string is empty)
    • the http module was updated to add http:params:toList and fix the http:server:[method] when passing a function
    • fixing the compiler when we encounter get fields in lists
    • updating the parser to support usually invalid constructions when they are in macros, to allow things like !{defun (name args body) (let name (fun args body))}
    • updated the lexer to add UTF8 support and allow unconventional identifiers as long as they aren't keyword nor operators, so things like -> now works
    • fixing the code optimizer to avoid removing unused variables which are defined on function calls
    • fixed the traceback generation on errors, it should now display the correct function names
    • reorganizing the compiler code
    • reorganizing the parser code to make it more maintainable
    • adding make_node<T> and make_node_list internally to avoid repetitive code
    • enhancing the parser atom method
    • enhancing the way we choose the subparser to use in the parser
    • avoid using std::endl if it's not useful
    • CI was split into multiple files to ease maintenance
    • moving ArkScript tests from tests/*.ark to tests/arkscript/*.ark
    • fixed macros adding useless begin blocks, sometimes breaking code generation from macros
    • moving std lib related tests into std/tests/
    • fixed macro chaining
    • fixed lexer, which wasn't adding the last token it read under some specific conditions

    Removed

    • ~UserType, since we are doing manual memory management now
    • Frame were removed because they were giving bad performances
    • firstOf was removed because it's basically a (@ list 0) and it was doing the job of head
    • Ark::Utils::toString, our internal version of std::to_string
    • use of static in the MacroProcessor and in the NodeType to string conversion function
    • Ark::Logger was removed in favor of std::cout/cerr + termcolor
    Source code(tar.gz)
    Source code(zip)
    linux64.zip(2.92 MB)
    win64.zip(3.74 MB)
  • v3.0.15(Dec 27, 2020)

    3.0.15

    Added

    • new submodule, plasma-umass/coz (a profiler)
    • macros for profiling, enabled only if ARK_PROFILE is defined
    • cmake flags using -D to turn on/off sys:exec and the coz profiler
    • mpark variant is now the default used instead of the default STL variant (faster, better, stronger, and its creator is quite a god)
    • new cmake flag, -DARK_SCOPE_DICHOTOMY=On|Off (default Off)
    • using internal only references to constants and symbols to reduce the number of useless copies of the value type

    Changed

    • updated standard library
    • updated modules, adding hash
    • updated the error handlers to avoid errors (sigsev) when handling errors (lexing, parsing, optimization and compilation error)
    • better error message at runtime when a plugin can not be found
    • fixes issue #203 (imports are ill-formed when given an absolute path)
    • fixes issue #205 (search for the standard library folder in more common places)
    • transitioning from C++ streams to printf
    • replaced the thirdparty/ folder with a git submodule in thirdparties/
    • now checking that a scope doesn't have our symbol before doing a mut operation (in dichotomic mode it was automatically handled, but not in linear mode)
    • enhancing the cmake defines (-DARK_XYZ) and the code using them
    • lighter Frame (from 40B to 32B), moved some unrelated logic from the frame to the virtual machine
    • (sys:exec) now returns the stdout output of the given command
    Source code(tar.gz)
    Source code(zip)
    linux64.zip(1.10 MB)
    win64.zip(3.79 MB)
  • v3.0.14(Nov 26, 2020)

    Changelog

    3.0.14

    Added

    • the parser can handle (let|mut a b.c) (bug fix)
    • f[ruv|no-ruv] CLI switch to control the optimizer (ruv stands for remove unused variables)
    • error message when we have too many parenthesis (at parse time)
    • error message when using an operator not right after a (
    • error message when we're capturing an unbound variable
    • added (sys:exit code) as a builtin
    • bytecode integrity checking through a sha256 in the header
    • tests for math:fibo and math:divs
    • added the ability to give scripts arguments, through sys:args

    Changed

    • the parser checks if set is given a dot expression as an identifier (which is an error)
    • the parser should take in account captured variables as well, otherwise some variables are optimized while they are captured, resulting in runtime errors
    • better unbound variable error message
    • (implementation) every constructor with a single argument is now marked as explicit
    • REPL does not need to add extra surrounding {}
    • the Ark::State (re)compiles a file even if there is a bytecode version available
    • the parser is now stricter and gives better error messages when we give too many/not enough arguments to a keyword
    • better handling of the code given to the REPL (adds new line)
    • renamed the executable from Ark to ark
    • now using Github Actions instead of Travis
    • the parser can now detect when let/mut/set are fed too many arguments, and generate an error
    • the compilater now handles (set a b.c.d)
    • using a new plugin interface, more C-like

    Removed

    • class Ark::internal::Inst which was used as a wrapper between uint8_t and Instruction
    • worthless examples were removed
    • removing f[no-]aitap since it wasn't used anymore in the code
    Source code(tar.gz)
    Source code(zip)
    linux64.zip(927.77 KB)
    win64.zip(3.51 MB)
  • v3.0.13(Oct 12, 2020)

    3.0.13

    Added

    • string tests
    • list tests
    • range tests
    • unbound variable checker at compile time (won't break on plugin symbols)

    Changed

    • list:find returns -1 to stay consistent with str:find
    • hot fix (mut a 10) (let b 12) (set a b) (set a 11), the immutability was transfered from b to a
    • converting list, append and concat to instructions
    • instructions LIST CONCAT and APPEND added to replace the corresponding builtins
    Source code(tar.gz)
    Source code(zip)
    linux64.zip(1.26 MB)
    win64.zip(3.24 MB)
  • v3.0.12(Sep 6, 2020)

    Change log

    The biggest release ever!

    3.0.12

    Added

    • using a macro to define the default filename (when none is given, eg when loading bytecode files or from the REPL)
    • PLUGIN <const id> instruction to load plugin dynamically and not when the VM boots up
    • updated search paths for (import "lib.ark"), looking in ./, lib/std/ and lib/
    • added a case to display NOT instructions in the bytecode reader
    • T& as<T>() in usertype
    • enhanced error message when calling a non-function object
    • eliminating unused global scope variables in the compiler
    • adding a new feature enabled by default: FeatureRemoveUnusedVars (not enabled for the REPL for obvious reasons)
    • added replxx as a submodule
    • added custom destructor to the user type, called when a scope is destroyed and when we use (del obj)
    • added a GVL (global virtual machine lock) to be able to use the VM in a multithreaded context
    • dockerfile + specific github action to build and push stable and nightly docker images, thanks to @yardenshoham
    • added guards to the bytecode reader to stop reading if we're missing an entry point; now telling the user about it

    Changed

    • updated the string module to benefit from the new format member function
    • updated the logger to remove fmt/format
    • changed the argument order for Ark::State
    • renamed the cache directory __arkscript__
    • operator @ can now handle negative indexes to get elements from the end of the given container
    • the standard library is now in another repository
    • moved the modules to lib/ext
    • the value of CODE_SEGMENT_START is again 0x03 (because we removed the plugin table)
    • renamed isDir? to dir? for consistency
    • the lexer is no longer using regexes but a char after char method
    • an ArkScript program is no longer a single bloc, but can be composed of multiple bloc, thus we don't need to use a single big {} or (begin) bloc for all the program
    • enhancing lexer and parser error messages
    • else clause in if constructions is now optional
    • updating error messages in the VM
    • updated the repl to add auto completion, coloration and persistance by @PierrePharel
    • moving the parser, lexer and AST node to Compiler/ from Parser/
    • better import error messages at parsing
    • format can now handle any value type
    • updated the tests to use the new standard library, and testing every VM instruction and builtins (we didn't test everything before, this way we can be sure we don't break anything in the VM after each update)
    • renaming builtins to add a namespace to them (math:, sys:, str:, list: and such)
    • firstOf, tailOf and headOf now returns [] or "" instead of nil when they have nothing to do
    • adding a brand new scoping system, lighter, more powerful
    • str:find now returns the index where the substring was found
    • str:removeAt was fixed to throw an error when the index is strictly equal to the length of the string (can not work since accessing elements in string is 0-index based)

    Removed

    • removed fmt/format from our dependencies
    • PLUGIN_TABLE was removed to use the PLUGIN instruction
    • not_() from usertype
    • removed Parser/Utf8Converter
    Source code(tar.gz)
    Source code(zip)
    linux64.zip(1.25 MB)
    win64.zip(3.01 MB)
  • v3.0.11(May 21, 2020)

    Change Log

    3.0.11

    Added

    • member function resolve(Args&& args...) to Value, callable by plugins to resolve the value of a function called with specific arguments given by the plugin
    • (fill qu value) create a list of qu values
    • (setListAt list at new-value) modify a list in place and return the new list value
    • adding UTF-8 support in programs (experimental)
    • more benchmarks
    • on error, the VM now display the value of each variable in the current scope
    • added thirdparty/madureira/String, to replace std::string in Ark::internal::Value which was heavy and slower than the new implementation
    • minimizing the size of the usertype

    Changed

    • UserType does not need to be given a manually defined type id but relies on typeid(T)
    • performance boost of the VM by using pointers to avoid unecessary copies
    • renaming isNaN to NaN?, isInf to Inf? for uniformisation (see empty?, nil?)
    • renaming CLI feature options:
      • -ffunction-arity-check becomes -ffac, same for the -fno- version
      • -fauthorize-invalid-token-after-paren becomes -faitap, some for the -fno- version
    • improving compiler performances by using const ref when passing nodes around
    • renaming the FFI "builtins" because it's not a FFI but a set of functions using the VM API
    • the VM should display a backtrace even if an unknown error occured
    • transforming inline code from the vm into not inline code when possible to speed compilation, using macros instead of inline functions
    • smaller value class
    • smaller vm frames
    • forked madureira/String and modified it for the needs of the project, added it as a submodule
    • removed the VM pointer from the value class to make it lighter, now the VM is sending a pointer of itself to the C procedures
    • removed const and type from value, now using a uint8_t to store those informations

    Removed

    • removed NFT from the internal API to rely only on the value type
    Source code(tar.gz)
    Source code(zip)
    linux64.zip(1.95 MB)
    win64.zip(2.71 MB)
  • v3.0.11-pre(Apr 28, 2020)

    3.0.11-pre

    Added

    • member function resolve(Args&& args...) to Value, callable by plugins to resolve the value of a function called with specific arguments given by the plugin
    • (fill qu value) create a list of qu values
    • (setListAt list at new-value) modify a list in place and return the new list value
    • adding UTF-8 support in programs (experimental)
    • more benchmarks

    Changed

    • UserType does not need to be given a manually defined type id but relies on typeid(T)
    • performance boost of the VM by using pointers to avoid unecessary copies
    • renaming isNaN to NaN?, isInf to Inf? for uniformisation (see empty?, nil?)
    • renaming CLI feature options:
      • -ffunction-arity-check becomes -ffac, same for the -fno- version
      • -fauthorize-invalid-token-after-paren becomes -faitap, some for the -fno- version
    • improving compiler performances by using const ref when passing nodes around
    • renaming the FFI "builtins" because it's not a FFI but a set of functions using the VM API
    • the VM should display a backtrace even if an unknown error occured
    • transforming inline code from the vm into not inline code when possible to speed compilation, using macros instead of inline functions

    Removed

    • removed NFT from the internal API to rely only on the value type
    Source code(tar.gz)
    Source code(zip)
    linux64.zip(1.62 MB)
    win64.zip(2.70 MB)
  • v3.0.10(Feb 9, 2020)

    3.0.10

    Added

    • adding sort to sort a list
    • added \t, \n, \v and \r escape codes (available in strings only)
    • adding listFiles which returns a list of paths (strings)
    • adding (makeDir path) and (removeFiles ...)
    • added (filter func list) in lib/Functional/Functional.ark
    • adding puts. Does the same thing as print but doesn't print a newline character
    • added a msgpack module by @PierrePharel
    • added a user type (to be defined in C++)
    • adding a not operator
    • adding an http module by @SuperFola

    Changed

    • updated output of tests with number of passed tests
    • updated REPL so that it doesn't try to compile blank lines or comments, by @rstefanic
    • the option -d|--debug is now repeatable, to set a debug level. Can go from 1 (compilation information) to 3 (a lot of information).
    • better precision when using (time)
    • better tests presentation
    • moved the modules to https://github.com/ArkScript-lang/modules
    Source code(tar.gz)
    Source code(zip)
    linux64.zip(1.38 MB)
    win64.zip(2.49 MB)
  • v3.0.9(Oct 26, 2019)

    3.0.9

    Added

    • fixing segfault when the VM receives an empty code page (generated from an empty block)
    • (print (fun () ())) will now print Function @ 1 instead of just its page addr, 1
    • (if true () ()) now returns nil (can be generalized to () -> nil)
    • anonymous functions are now available ; eg: ((fun () (print "a")))
    • added forEach in library
    • added -c|--compile option to the CLI so that we can only compile an ArkScript file instead of compiling and running it, by @DontBelieveMe
    • added min and max in lib/Math/Arithmetic.ark, by @FrenchMasterSword
    • added reduce in lib/Functional/Reduce.ark, by @FrenchMasterSword
    • added product in lib/List/Product.ark, by @FrenchMasterSword

    Changed

    • a quoted code (defered evaluation) isn't capturing anymore surrounding variables' values, thus increasing greatly performances
    • lists are printed like ["string" 1 true] now, instead of ( string 1 true )
    • updated zip so that it can work with lists of different sizes, by @FrenchMasterSword
    • better cyclic includes detection
    • better VM error message when redefining a variable through let
    Source code(tar.gz)
    Source code(zip)
    linux64.zip(1.09 MB)
    win64.zip(2.18 MB)
  • v3.0.8(Oct 22, 2019)

    3.0.8

    Added

    • it's now possible to compare Values using operator<
    • reverseList (added to the FFI) by @rinz13r
    • a warning will now pop up during compilation if code appears to be ill-formed (eg number/string/list right after a ()
    • option -f(allow-invalid-token-after-paren|no-invalid-token-after-paren) was added (default: OFF)

    Changed

    • the internal API used to compare values has been updated to be much shorter
    • the REPL can take into account the lib directory, by @rstefanic
    • isNaN and isInf should work on any type but return false if they aren't numbers
    • replacing Ark with ArkScript in source code and files (Ark being the shortname for ArkScript, as JS is the shortname for Javascript)
    • findInList now returns nil when the object can not be found, otherwise it returns its index in the list
    Source code(tar.gz)
    Source code(zip)
    linux64.zip(1.10 MB)
    win64.zip(2.20 MB)
  • v3.0.7(Oct 15, 2019)

    3.0.7

    Added

    • cos, arccos, sin, arcsin, tan, arctan
    • E (exp 1), Pi, Tau (2 * Pi), NaN, Inf
    • isNaN, isInf
    • exp, ln (standard logarithm), pow, sqrt
    • ceil, round, floor
    • zip, map, sum
    • REPL, made by @rstefanic

    Changed

    • moved the lib files in subfolders to be more organized
    • re-updating the import rules on the parser side to be able to import files in subfolders from the standard library
    • updating naming convention of the modules
    Source code(tar.gz)
    Source code(zip)
    linux64.zip(1.08 MB)
    win64.zip(2.15 MB)
  • v3.0.6-b(Oct 9, 2019)

  • v3.0.6(Oct 7, 2019)

    3.0.6

    Added

    • function arity handling in the VM, can be disabled with the option -fno-function-arity-check
    • sliceStr in lib/Slice.ark, taking a string, a starting index (can't be less than 0), and the length (can't be less than 1), returning a portion of the given string
    • reverseStr in lib/Reverse.ark taking a string and returning it in reverse

    Changed

    • updated the include module, which was randomly adding / before the path of the files
    • dispatched the unit tests in multiple files
    • now using a separated class to hold the description values for the VM
    • updated assertions in split in lib/Split.ark (works only with single character separators)
    • fixing import bug
    Source code(tar.gz)
    Source code(zip)
    linux64.zip(994.55 KB)
    win64.zip(1.93 MB)
  • v3.0.5(Oct 4, 2019)

    3.0.5

    Added

    • the parser can now recognize expressions like ((f f) x)
    • we can now create Ark::Value with floats

    Changed

    • the init() internal method of the VM shouldn't stop when a binded function isn't used in the code, just ignore it
    • the compiler shouldn't crash on a bad code block
    • better line counter in lexer
    • the VM shouldn't try to run a non-existing bytecode file if the compilation fails (when calling doFile())
    • VM.call should return nil if the stack is empty, otherwise it results in a vector subscript out of range and that's bad
    • the SFML plugin was updated to run on Windows

    Shipping with the compiled modules this time

    Source code(tar.gz)
    Source code(zip)
    Ark-linux64.zip(3.61 MB)
    Ark-win64.zip(1.74 MB)
  • v3.0.4(Sep 1, 2019)

    Change log

    3.0.4

    Added

    • with the option -L|--lib we can set the path to the ArkScript standard library
    • we can now load C++ lambdas into the ArkVM, as well as C++ functions
    • adding function sleep, taking a duration in milliseconds
    • adding function system, taking a command from a string ; can be deleted if ARK_ENABLE_SYSTEM is set to 0 in the CMakeLists

    Changed

    • updating CMakeLists.txt to avoid building unuseful stuff from google benchmark
    • toNumber doesn't raise an unrecoverable error but returns nil if the conversion failed
    • print no longer add a space between each element
    • updating the way the builtins are handled (in VM/FFI) to make it easier to add functions

    Removed

    • doc folder, now everything is on the wiki
    Source code(tar.gz)
    Source code(zip)
    Ark-linux64.zip(672.91 KB)
    Ark-win64.zip(720.13 KB)
    lib.zip(1.39 KB)
  • v3.0.3(Aug 23, 2019)

    3.0.3

    Added

    • should be able to compare lists
    • chained operators: (+ 1 2 3) is automatically expanded (at compile time) into (+ (+ 1 2) 3) by the compiler

    Changed

    • some functions playing with list should also be able to play with Strings: headof, tailof, firstof, len, empty?, @
    • firstof should segfault when the list/String is empty
    • fixing type of nil to be "Nil" instead of nil when using (type nil)
    • uniformised names of builtins: pascal case (impacted functions are firstOf, headOf and tailOf, as well as hasField)
    • fixing bug with writeFile when sending a mode: the mode was also the content of the file, it no longer is
    Source code(tar.gz)
    Source code(zip)
    Ark-linux64.zip(640.09 KB)
    Ark-win64.zip(658.80 KB)
  • v3.0.2(Aug 22, 2019)

Owner
ArkScript
Repositories related to ArkScript lang
ArkScript
A concatenative functional language to be used as a sidekick for the mlatu language

gerku _, | | __ _, ___ ,_ __ | | __ _, _, /\___ / _` | / _ \| '__)| |

Remo Dentato 9 Jan 14, 2022
Simple, fast, JIT-compiled scripting language for game engines.

Aftel Aftel (acronym for «A Far Too Easy Language») is a programming language, primarily intended to serve as an embeddable scripting language for gam

Rosie 17 May 20, 2022
Sharpmake is an open-source C#-based solution for generating project definition files, such as Visual Studio projects and solutions, GNU makefiles, Xcode projects, etc.

Sharpmake Introduction Sharpmake is a generator for Visual Studio projects and solutions. It is similar to CMake and Premake, but it is designed for s

Ubisoft 779 Dec 23, 2022
Somewhat functional dynamically typed language

Wellang About This is a project originally started by Tristan Wellman(read CONTRIBUTING.md for contribution info). This is a high level assembly langu

wellang 55 Nov 13, 2022
🎩 An interpreted general-purpose scripting language 🔨

Dunamis Version 0.0.0.2 - Alpha Version 1.1 An interpreted general-purpose programming language Contents Syntax Functions Variables Objects Enums Incl

Tech Penguin 4 Dec 21, 2021
a C++ scripting language

/>mpl setup />mpl requires CMake and a C++ compiler to build, rlwrap is highly recommended for running the REPL. $ cd ampl $ mkdir build $ cd build $

Andreas Nilsson 2 Nov 6, 2021
A scripting language written in C

News KGScript will be rewritten from scratch in C or C++ (a big update) Usage Usage: ./KGScript file.kgs [options] Examples prints("Example") printi(1

null 16 Nov 12, 2021
ACL - A simple scripting language made in c++

ACL ACL is a simple and easy to learn language. ACL is a compiled language, made with C++. For code examples look at the examples/ folder. We would ap

Niclas 10 Nov 1, 2022
The UwU's Scripting language. Made with love for UwU Nyanny Commuwiwwy!

UwUscript UwUscript is a scripting language. Installation Prerequisite LLVM 10.0 flex and bison. CMake 3.10 Build Clone this repository. git clone htt

UwUssimo Robinson 8 Nov 28, 2022
A small and fast programming language.

Pocketlang is a small (~3000 semicolons) and fast functional language written in C. It's syntactically similar to Ruby and it can be learned within 15

Thakee Nathees 1.4k Dec 28, 2022
PLP Project Programming Language | Programming for projects and computer science and research on computer and programming.

PLPv2b PLP Project Programming Language Programming Language for projects and computer science and research on computer and programming. What is PLP L

PLP Language 5 Aug 20, 2022
Flutter-Clock-and-Reminder-App - a highly functional clock and reminder app developed on flutter framework.

clock_app A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if thi

Umar Baloch 6 Aug 4, 2022
Bringing the power, stability and functional capabilities of C++ to Python.

going-native-py Bringing the power, stability and functional capabilities of C++ to Python. This is just a get your hands dirty approach and should be

Jan Tschada 7 May 22, 2021
A fully-functional open source and open hardware mechanical USB computer keyboard with only three keys!

threeboard threeboard is a fully-functional open source and open hardware mechanical USB computer keyboard with only three keys. It supports multiple

Conor Taylor 98 Dec 9, 2022
A modern and functional replacement for the About Windows dialog

Modern Winver A modern and more functional replacement for the About Windows screen powered by UWP and RegistryRT, providing details on Windows and yo

Torch 147 Dec 21, 2022
Functional programming style pattern-matching library for C++

Mach7: Pattern Matching for C++ by Yuriy Solodkyy, Gabriel Dos Reis, Bjarne Stroustrup Abstract Pattern matching is an abstraction mechanism that can

Yuriy Solodkyy 1.2k Dec 26, 2022
Functional C++ iterator library

iter (alpha) Functional C++20 iterator library. Godbolt demo Small, single header, feature-rich, functional C++20 iterator library that aims to be sim

Nasal Daemon 17 Dec 5, 2022
A bytecode interpreter for statically typed functional languages.

A bytecode interpreter for statically typed functional languages.

Luc Tielen 2 Dec 25, 2021