37# include <gtest/gtest.h>
50 std::vector<std::string>
53 std::vector<std::string>
codes;
54 for (
size_t i = 0; i < dx.
size(); ++i)
61 const std::string &
code)
63 for (
const auto & item :
codes)
80 "let value = add(1, 2);\n");
85 const auto *
module = parser.parse_module();
89 sema.analyze_module(module);
95 const auto *
fn =
module->functions.access(0);
138 "fn dup(x, x) { let y = 1; let y = 2; }\n"
140 "fn shadow(a) { { let a = 1; } }\n");
145 const auto *
module = parser.parse_module();
151 sema.analyze_module(module);
165 "struct Point { x: Int; }\n"
166 "enum Point { Origin }\n");
171 const auto *
module = parser.parse_module();
175 sema.analyze_module(module);
188 "import \"dep.aw\";\n"
189 "import \"dep.aw\";\n"
190 "import \"main.aw\";\n");
195 const auto *
module = parser.parse_module();
199 sema.analyze_module(module);
222 const auto *
module = parser.parse_module();
226 sema.analyze_module(module);
Recursive-descent parser for the compiler-support MVP grammar.
Name-resolution and basic semantic checks for the compiler-support MVP.
Arena-backed ownership context for AST nodes.
Recursive-descent parser that produces an AST in Compiler_Ast_Context.
Name-resolution and basic semantic checker for the MVP AST.
Diagnostic accumulator and renderer.
bool has_errors() const noexcept
Returns whether any error or fatal diagnostic was emitted.
const Diagnostic & get(const size_t i) const
Returns diagnostic i.
size_t size() const noexcept
Returns the number of stored diagnostics.
Stores source files and resolves offsets into human-readable data.
Source_File_Id add_virtual_file(const std::string &name, const std::string &text)
Registers an in-memory source file.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Main namespace for Aleph-w library functions.
std::string code(Node *root)
Compute a string with the Lukasiewicz`s word of a tree.
T sum(const Container &container, const T &init=T{})
Compute sum of all elements.
Node representing an infix binary operation.
Node representing a function or method call.
Node representing a named identifier reference.
Node representing a local variable binding.
Node representing a return from the current function.
Options controlling semantic analyzer behavior.
bool allow_shadowing
If false, nested redefinitions report SEM007.
std::string code
Optional stable code such as E001.