arkscript-lang / ark Goto Github PK
View Code? Open in Web Editor NEWArkScript is a small, fast, functional and scripting language for C++ projects
Home Page: https://arkscript-lang.dev/
License: Mozilla Public License 2.0
ArkScript is a small, fast, functional and scripting language for C++ projects
Home Page: https://arkscript-lang.dev/
License: Mozilla Public License 2.0
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)
Describe the bug
i Tryed to run unittest.ark, and it says "ParseError: Couldn't find file Switch.ark"
Note: i run it without the --lib argument
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I Expect to import the module, wich is already installed with Ark Releases
Desktop (please complete the following information):
Is your feature request related to a problem? Please describe.
The representation (through print
) of lists are their content in parentheses.
For example (print [1 2])
outputs ( 1 2 )
This representation looks like a block (of code) and doesn't really hint that the object considered is a list.
Describe the solution you'd like
I think it would be better if the representation matched the syntactic sugar used in
the programs: [a b c]
Describe alternatives you've considered
[ a b c ]
, or (list a b c)
(according to what the syntactic sugar refers to).
Describe the bug
The REPL segfaults when:
#
)Expected behavior
Same behavior as if the user had directly pressed <ENTER>
: "nothing" (new line and new prompt)
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.
Is your feature request related to a problem? Please describe.
We should be able to choose what we need to "import" from another scope.
Describe the solution you'd like
(fun (name age)
(fun (foo &name) ())
)
Arguments starting with &
aren't arguments but captured values.
Is your feature request related to a problem? Please describe.
Well, i'm trying to do a sort of Command line OS (fo no reason), and i think it could be nice if i can list all files of the current Directory/Path
Describe the solution you'd like
Add a method to list all the files in a array
Describe alternatives you've considered
(listAllFiles ".") Files of the current directory (also default argument)
(listAllFiles "C:\Users\Natend\Desktop\Programmation") Mmh maybe not \
Additional context
For creation of system that can see files (a.k.a : OS, IDE, Lots of things)
Describe the bug
When sending End of File to the REPL, it prints indefinitely the prompt >>
To Reproduce
Steps to reproduce the behavior:
Ark -r
^D
)>>
is printed indefinitelyExpected behavior
The REPL exits
Desktop (please complete the following information):
OS: Arch Linux
Ark compiled with g++ (GCC) 9.2.0
from branch dev
In this moment, I'm working on msgpack module for Ark, and I need an clear and explicit way for define custom types for modules (plugin).
It's pretty messy right now
Could be based upon cpp httplib
At this point where modules are starting to be more numerous, we should (imo) consider having an ArkScript package manager.
Won't be for the 3.1.0, more like a 3.2.0 or even a 3.x.0
eg. the parser and compiler should detect errors like (fun output (@ mylist index)) which isn't a valid function definition
To be able to create packed messages to send on the internet when the network module will be available.
This issue will be used to keep track of the needed builtins and std lib functionnalities for the 3.1.0
(zip list1 list2)
(map func list1)
(slice array from_index to_index step)
(slice string from_index to_index step)
(removeAtStr string index)
exp
and log
)pow
)Not part of the standard library anymore, was moved to https://github.com/SuperFola/arksfml
It should return a reference to an object in the global scope, setting nil as the value if it doesn't exist yet
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?
If we move description related data to an Ark::State as suggested in #35, we should be able to share a single state between multiple virtual machines, thus allowing multi threading
m_environment.reserve(64);
should be m_environment.reserve(length);
in rework/src/VM/Frame.cpp
Is your feature request related to a problem? Please describe.
As i already said, i'm doing a mini Os in Ark (#28) so it also could be useful to have an CLS method !
Describe the solution you'd like
CLS Method
Describe alternatives you've considered
(clearScreen)
(clearScreen 5) A specific number of lines
Additional context
Mmmh, For a Lot of console thing like as a Command line OS ?
Instead of having to send all the argument using the command line (which can lead to a pretty long command), we should be able to have a project.arkopt
for example, with a list of options which should be triggered.
For example:
cool-project/
|___ cool-project.arkopt
|___ thing.ark
|___ ...
cool-project.arkopt
# file to run
thing.ark
# options
-fno-function-arity-check
-f...
And when we run Ark cool-project
it will search for a cool-project
ArkScript file, but not find it, thus it should look for a cool-project.arkopt
and use its content as the options of the command line.
Describe the bug
The parser is parsing { (let a nil) (let b false) (let c true) }
as ( Begin ( Let a nil ) Begin ( Let b false ) Begin ( Let c true ) )
. It's not a problem with the syntactic sugar, since we have this:
[ Info ] (Parser) After applying sugar:
1 | (
| begin
2 | (
| let
| a
| nil
| )
3 | (
| let
| b
| false
| )
4 | (
| let
| c
| true
| )
5 | )
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The parser shouldn't put that many begins (one before each block, WHY?).
Desktop (please complete the following information):
Is your feature request related to a problem? Please describe.
I followed the build steps on macOS, until cmake --build build
. It ends with:
~/lisp/Ark/include/Ark/Utils.hpp:10:10: fatal error: 'filesystem' file not found
#include <filesystem>
^~~~~~~~~~~~
The comment on the next step ("works on Linux and on Windows") implies that the project is not meant to be built on macOS.
Is that the case, or perhaps I'm missing a dependency?
Describe the solution you'd like
I'd love to be able to play with ArkScript on macOS.
Additional context
As context, I'm pretty much a beginner with C++, so I have no clue whether filesystem
is a platform-specific thing.
Is your feature request related to a problem? Please describe.
We must be able to read public (immutable) data from a closure.
Describe the solution you'd like
eg: (print closure.field)
should also mark the Value as const
We need to have at least:
write file
read file
file exists?
type
hasfield
eg. the VM should display the name of the variable which is redefined by let
It erases frames but shouldn't
Is your feature request related to a problem? Please describe.
Well nope, but it could be nice for reading
Describe the solution you'd like
add a method that change the color , or the background color
Describe alternatives you've considered
(consoleColor "1") (4Bits console colors)
(consoleBackgroundColor "2") (4 bits console colors)
Additional context
Mmmh, for better interactions beetwen user and program
Describe the bug
toUpperCase and toLowerCase returning "Unknown Error"
To Reproduce
Steps to reproduce the behavior:
1.Import Case.ark
2. try (toLowerCase "Some StringYY sTuffY") or another string NB : you can also do this with toUpperCase
3. Enjoy the bug
Note : sometimes it returns another error like bad allocation
Expected behavior
Returning the string to lowercase (or to upper)
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
Seems to happen with the latest version of Case.ark (i tried with an old version and it works)
Ark-windows-x64.exe Bug
After moving it to C:\Program Files (x86)\Ark\bin , i can't use it to launch the .ark file
that's kinda weird, because it worked before (when the file was on my Desktop)
Should be able to type in code, wait for count("(") == count(")")
before compiling.
Store code in buffer, compile and execute after each line.
Is your feature request related to a problem? Please describe.
We should be able to use Ark file
to automatically compile the file only if needed, and then execute it on the virtual machine.
Describe the solution you'd like
Check if there is a bytecode file in the Ark cache for the given input file, and if it is older than the given file, recompile. Otherwise (if not older), launch the bytecode file located in the Ark cache (maybe provide something like Python, a __arkcache__
folder). If the file isn't in the Ark cache (or if the Ark cache doesn't exist yet), compile it, put it in the Ark cache, and execute it.
Describe the bug
When launching Ark tests/games/snake/snake.ark -c
, it crashes because it can't create a token from (()
at line 13, char 38 (this token isn't in the file).
To Reproduce
Steps to reproduce the behavior:
git checkout rework
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build
build/Ark tests/games/snake/snake.ark -c
Expected behavior
No errors expected.
Desktop (please complete the following information):
Additional context
Must be related to the new lexer, the parser is just reporting a bug because it uses the lexer
Since the language is evolving, its documentation should evolve as well. The language itself needs to be documented, but the standard library and the Virtual Machine/Bytecode as well
The program {(while (= 1 1) "foo" "bar")}
segfaults the compiler.
(gdb) run foo.ark
Starting program: /tmp/Ark/build/Ark foo.ark
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7bce3c0 in __memcmp_avx2_movbe () from /usr/lib/libc.so.6
(gdb) bt
#0 0x00007ffff7bce3c0 in __memcmp_avx2_movbe () from /usr/lib/libc.so.6
#1 0x00007ffff7eda920 in std::char_traits<char>::compare (__n=<optimized out>, __s2=0x555555624a70 ")",
__s1=<optimized out>) at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/char_traits.h:325
#2 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare (this=0x7fffffffc6a8,
__s=0x555555624a70 ")")
at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:1425
#3 0x0000555555579e4b in bool std::operator==<char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*) ()
#4 0x0000555555579fe5 in bool std::operator!=<char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*) ()
#5 0x000055555560171b in Ark::Parser::parse(std::__cxx11::list<Ark::internal::Token, std::allocator<Ark::internal::Token> >&, bool, bool) ()
#6 0x0000555555600156 in Ark::Parser::feed(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
#7 0x00005555555ea93c in Ark::Compiler::feed(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
#8 0x000055555555e67b in Ark::compile(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
#9 0x000055555557c1da in Ark::VM_t<false>::doFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
#10 0x000055555555f711 in main ()
Additionally, I think that the benchmark files are missing from this repository and I had to modify build.sh because it assumed my system runs GCC 8, but Arch provides GCC 9, and ((f f) x)
isn't recognised as valid syntax by the reader, but the segfault is my biggest concern now.
Describe the bug
This test is failing, and so is switch.ark, since it's using the same method for defered calls.
{
(let egg (fun (bar) (print bar)))
(let data ["Iron Man" "is" "Tony Stark"])
(let callbacks [])
(let add-callback (fun (d)
(fun () (egg d))
))
(let acc 0)
(while (!= acc (len data)) {
(let d (@ data acc))
(set callbacks (append callbacks (add-callback d)))
(set acc (+ 1 acc))
})
(set acc 0)
(while (!= acc (len callbacks)) {
((@ callbacks acc))
(set acc (+ 1 acc))
})
}
To Reproduce
Steps to reproduce the behavior:
Expected behavior
We should see
Iron Man
is
Tony Stark
in the shell, not an error.
Desktop (please complete the following information):
Additional context
Must be related to the parser
Rules list is quite simple:
string: ^"[^"]*
number: ^((\+|-)?[[:digit:]]+)(\.(([[:digit:]]+)?))?
operator: ^(\+|\-|\*|/|<=|>=|!=|<|>|@=|@|=|\^)
identifier: ^[a-zA-Z_\u0080-\uDB7F][a-zA-Z0-9_\u0080-\uDB7F\-?']*
capture: ^&[a-zA-Z_\u0080-\uDB7F][a-zA-Z0-9_\u0080-\uDB7F\-?']*
getfield: ^\.[a-zA-Z_\u0080-\uDB7F][a-zA-Z0-9_\u0080-\uDB7F\-?']*
skip: ^[\s]+
comment: ^#.*
shorthand: ^[']
mismatch: ^.
Instead of using shared pointer, we should have raw pointers to elements in a std::list owned by the VM. (see comment)
Description related data owned by the VM should also be moved to a lighter structure (Ark::State)
~
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.