Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [Unreleased version] - 20XX-XX-XX
### Added
- new builtin `disassemble` to print the bytecode of a function
- new builtin `io:readFileLines` to read lines from a file as a list of strings

### Changed
- the formatter properly formats dictionaries (key-value pairs on their own line, always)
Expand Down
2 changes: 1 addition & 1 deletion examples/closures.ark
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Inspired by
# Closures and object are equivalent: http://wiki.c2.com/?ClosuresAndObjectsAreEquivalent
# this will construct a closure capturing the 3 arguments, plus a function to set the age
(let create-human (fun (name age weight) {
(let create-human (fun (name (mut age) weight) {
# functions can be invoked in the closure scope
(let set-age (fun (new-age)
(set age new-age)))
Expand Down
1 change: 1 addition & 0 deletions include/Ark/Builtins/Builtins.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ namespace Ark::internal::Builtins
ARK_BUILTIN(writeFile);
ARK_BUILTIN(appendToFile);
ARK_BUILTIN(readFile);
ARK_BUILTIN(readLinesFile);
ARK_BUILTIN(fileExists);
ARK_BUILTIN(listFiles);
ARK_BUILTIN(isDirectory);
Expand Down
6 changes: 5 additions & 1 deletion include/Ark/Compiler/Common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ namespace Ark::internal
enum class NodeType
{
Symbol,
MutArg,
RefArg,
Capture,
Keyword,
String,
Expand All @@ -56,8 +58,10 @@ namespace Ark::internal
};

/// Node types as string, in the same order as the enum NodeType
constexpr std::array<std::string_view, 11> nodeTypes = {
constexpr std::array<std::string_view, 13> nodeTypes = {
"Symbol",
"MutArg",
"RefArg",
"Capture",
"Keyword",
"String",
Expand Down
Loading
Loading