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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
- check on number of arguments passed to `type`
- warning when the formatter deletes comment(s) by mistake
- check on arguments passed to `list`, `concat`, `append` and friends to only push valid nodes (that produces a value)
- `$paste` to paste a node inside a maro without evaluating it further ; useful to stop recursive evaluation of nodes inside function macros
- introduced `Ark::internal::Pass` to describe compiler passes: they all output an AST (parser, import solver, macro processor, and optimizer for now)
- add `-f(no-)importsolver`, `-f(no-)macroprocessor` and `-f(no-)optimizer` to toggle on and off those compiler passes
- added resolving `empty?` as a macro when possible
Expand All @@ -37,6 +36,7 @@
- basic dead code elimination in the AST optimizer
- new operator `@@` to get elements in list of lists / list of strings
- new builtin `random`, returning a random number between INT_MIN and INT_MAX, or in a custom range
- `$as-is` to paste a node inside a maro without evaluating it further ; useful to stop recursive evaluation of nodes inside function macros

### Changed
- instructions are on 4 bytes: 1 byte for the instruction, 1 byte of padding, 2 bytes for an immediate argument
Expand Down
4 changes: 2 additions & 2 deletions include/Ark/Compiler/Common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ namespace Ark::internal
constexpr std::string_view Symcat = "$symcat";
constexpr std::string_view Argcount = "$argcount";
constexpr std::string_view Repr = "$repr";
constexpr std::string_view Paste = "$paste";
constexpr std::string_view AsIs = "$as-is";

constexpr std::array macros = {
Undef,
Symcat,
Argcount,
Repr,
Paste
AsIs
};

// This list is related to include/Ark/Compiler/Instructions.hpp
Expand Down
2 changes: 1 addition & 1 deletion lib/std
Submodule std updated 1 files
+7 −7 Testing.ark
4 changes: 2 additions & 2 deletions src/arkreactor/Compiler/Macros/Processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,10 +568,10 @@ namespace Ark::internal
const Node ast = node.constList()[1];
node.updateValueAndType(Node(NodeType::String, ast.repr()));
}
else if (name == Language::Paste)
else if (name == Language::AsIs)
{
if (node.list().size() != 2)
throwMacroProcessingError(fmt::format("When expanding `{}', expected one argument, got {} arguments", Language::Paste, argcount), node);
throwMacroProcessingError(fmt::format("When expanding `{}', expected one argument, got {} arguments", Language::AsIs, argcount), node);
return node.constList()[1];
}
else if (name == Language::Undef)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
($ a ($paste b []))
($ a ($as-is b []))
(p0000 a)
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
($ a ($paste b []))
($ a ($as-is b []))
(print a)
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
($ a ($paste b []))
($ a ($as-is b []))
(print a)
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
($ a ($paste b []))
($ a ($as-is b []))
(print a)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
At ($paste b (list)) @ 1:7
1 | ($ a ($paste b []))
At ($as-is b (list)) @ 1:7
1 | ($ a ($as-is b []))
| ^~~~~~~~~~~~~~~~~~~
2 | (print a)
3 |
When expanding `$paste', expected one argument, got 2 arguments
When expanding `$as-is', expected one argument, got 2 arguments
Loading